Java 8 Generics in 3 Hours
Ever since its introduction in Java 5, the Generics mechanism has been an important part of the Java programming language. However, prior to Java 8, most programmers found it was generally sufficient to know how to type their uses of library classes such as List and Map. With the introduction of lambda expressions with Java 8, it becomes much more important to have a good grasp of the breadth and depth of what generics let us do, and what the more esoteric generics expressions that are now commonplace in the API documentation really mean.
What you'll learn-and how you can apply it
- This course will lead you to understanding the features of the generics mechanism, you’ll be able to create your own generic classes, interfaces, and methods.
- You’ll learn the meanings of code that uses constructions like <E extends SomeType> and <? super OtherType>
- You’ll learn why you care about these capabilities, how they can lead to more-reusable code, why they get extensive use with the functional features of Java 8
- And you’ll discover techniques to help the compiler when type inferencing can’t work out what you meant, even though it seems like you expressed your idea correctly.
This training course is for you because...
- You want to increase your knowledge and skills in Java programming and create more-reusable code
- You’re using Java 8 and the functional features and need to understand how generics underpins this
- You’re a college student looking for additional learning resources to help you with a Java course you’re taking
- You should be comfortable writing code in the Java programming language and able to read code of intermediate complexity. Superficial familiarity with using generic API classes (such as List) will help, but is probably not essential.
Materials, downloads, or Supplemental Content needed in advance:
- While not required for participation, it’s a good idea if you have a Java development environment (e.g. NetBeans, Eclipse, Intelli-J IDEA or similar) so that you can experiment with the material you learn in the class.
- Source code repository on github.com will be used to distribute examples and other materials created during the course
Java Programming Basics
This course provides an introduction the Java Programming Language and would be particularly appropriate for anyone with minimal background in Java before attending this live training. https://sunburn.in/?page=library/view/java-programming-basics/9780133975154/
Modern Java Collections
This course addresses Java’s collections API in detail and builds basic understanding of the generics mechanism from the usage perspective https://sunburn.in/?page=library/view/modern-java-collections/9780134663524/
About your instructor
Simon started out working as a software engineer, specializing in industrial control systems, and had a sideline teaching for a local University in his then-home-town of Cambridge, England.
In 1995 he joined Sun Microsystems, Inc. as a senior instructor and course developer. Simon spearheaded the introduction of Java training by Sun Microsystems in the U.K. in 1995. He developed the first Java certification exams for Sun before he moved to the U.S. in 1998.
Since leaving Sun in 2004, Simon has developed and delivered training for clients around the world.
Simon believes that training should have an immediate purpose and application, and that the most effective training is usually "on the job" mentoring, helping to remove the immediate roadblocks to productivity that so often plague workers in fast moving environments.
The timeframes are only estimates and may vary according to how the class is progressing
Introduction to Generics, providing compile time type safety (30 mins)
Creating a simple generic class or interface, using multiple type variables (30 mins)
10 min break
Using bounded types to constrain usage, requiring multiple bounds (30 mins)
Generic types with object generalization and specialization, examining the requirements of Liskov substitution (30 mins)
10 min break
The interaction of inheritance and generics; understanding covariance and contravariance (30 mins)
Consequences of type erasure, interactions with arrays, heap pollution, bridge methods, and non-reifiable types (30 mins)