Skip to Main Content
Beginning Java 8 Language Features: Lambda Expressions, Inner Classes, Th reads, I/O, Collections,and Streams
book

Beginning Java 8 Language Features: Lambda Expressions, Inner Classes, Th reads, I/O, Collections,and Streams

by Kishori Sharan
August 2014
Intermediate to advanced content levelIntermediate to advanced
704 pages
20h 16m
English
Apress
Content preview from Beginning Java 8 Language Features: Lambda Expressions, Inner Classes, Th reads, I/O, Collections,and Streams

CHAPTER 4

image

Generics

In this chapter, you will learn

  • What generics are
  • How to define generic types, methods, and constructors
  • How to define bounds for type parameters
  • How to use wildcards as the actual type parameters
  • How the compiler infers the actual type parameters for generic type uses
  • Generics and their limitations in array creations
  • How the incorrect use of generics may lead to heap pollution

What Are Generics?

Generics let you write true polymorphic code, which is code that works with any type. Please refer to Chapter 1 in the book Beginning Java Fundamentals (ISBN 978-1-4302-6652-5) for more details on polymorphism and writing polymorphic ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Lambdas and the Stream API: Bringing Functional Programming to Java

Java Lambdas and the Stream API: Bringing Functional Programming to Java

James McLaughlin

Publisher Resources

ISBN: 9781430266594Purchase book