I came across a piece of code as follows:
final static Map<String, Supplier<Shape>> map = new HashMap<>();
map.put("CIRCLE", Circle::new);
Where Circle
is a class. I guess here new
is used to access the constructor of the class Circle
. How can new
be used like this? What is this technique called? I could not find any documentation.