Write Better Code, Faster, with Java Generics

Generics are the largest and most important change to the Java programming language since it was introduced. Although the fundamentals of generics are easy to absorb, misunderstandings persist and common use-cases are not well understood. For example, what is “migration compatibility,” and why is it central to the design of generics? What strategies do you have for migrating an existing library? What pitfalls need to be avoided when combining generics and arrays? What do wildcards really represent, and how should you use them? This session will use the ideas underlying generics to answer these and other common questions.

Presentasjon

MP3
Foredragsholder Maurice Naftalin
Nivå
• Motivation for generics (5)
	o Cleaner code, stronger compile-time typing, more expressive interfaces
• Benefits of implementation by erasure: migration compatibility (15)
	o Migration strategies: surface generification, stubs, wrappers
• Problems with erasure (15)
	o Array typing vs generic typing, converting a collection to an array
	o Principle of Truth in Advertising*, Principle of Indecent Exposure*
• Wildcard types: what they are and how to use them (10)
• What next for generics? (5)
Experience: Participants should be familiar with the basic ideas of generics

Audience: Practising programmers working or soon to work with Java 5 or Java 6