Generics

Simple to understand

Java7 introduces generics with diamond syntax, which simplifies generic programming. Such as:
List<String> list = new ArrayList<>();

Diving into Generics

  1. Using generics to declare classes, you can dynamically generate multiple logical subclasses, which are always the same class at runtime (only one class file).
  2. type wildcard
  3. generic method

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324702022&siteId=291194637