Week 05: Generics
-
After this unit, students should
- know how to define and instantiate a generic type and a generic method.
- be familiar with the term parameterized types, type arguments, type parameters.
- appreciate how generics can reduce duplication of code and improve type safety.
-
After this unit, students should
- understand that generics are implemented with type erasure in Java.
- understand that type information is not fully available during run-time when generics are used, and problems that this could cause.
- be aware that arrays and generics don't mix well in Java.
- know the terms reifiable type and heap pollution.
-
After this unit, students should
- be aware of how to use generics with an array.
- be aware of unchecked warnings that compilers can give when we are using generics.
- be able to make arguments as to why a piece of code is type-safe for simple cases.
- know how to suppress warnings from compilers.
- be aware of the ethics when using the @SuppressWarnings("unchecked") annotation.
- know what is a raw type.
- be aware that raw types should never never be used in modern Java.