diamond operator

The empty angle brackets in new ArrayList<>(), which ask the compiler to infer the constructor's type arguments.

In more detail

The type comes from the declaration on the left, so you do not repeat it. Leaving the brackets off entirely is different: that creates a raw type and loses the compiler checks.

Example

List<Number> values = new ArrayList<>();

Related terms

Taught in

References

Certification courses