Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 944 Bytes

File metadata and controls

28 lines (20 loc) · 944 Bytes

Diamond Operator

Objective
Develop code that uses diamond with generic declarations

Diamond Operator was created in Java 7 to remove unnecessary code when declaring classes that use Generics (or generic types). Below is an example that you can omit the type of some classes using Diamond Operator.

src/org/j6toj8/collections/diamond/Collections_Diamond.java
link:../../../src/org/j6toj8/collections/diamond/Collections_Diamond.java[role=include]
References
  • Using the Diamond Operator

    Boyarsky, Jeanne; Selikoff, Scott. OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide (p. 596). Wiley. Kindle Edition.

  • Guide to the Diamond Operator in Java.