It's called a wildcard, it just means you don't need to specify the generic type. It is sometimes useful, but should not be used in general. One case where you can use it safely is when you use a type bound :
public void withWildCard(List<? extends Collection<Integer>> collections) {
...
}
public void withoutWildCard(List<Collection<Integer>> collections) {
...
}
List<Collection<Integer>> listOfCollections;
withWildcard(listOfCollections); // valid call
withoutWildcard(listOfCollections); // valid call
List<List<Integer>> listOfLists;
withWildcard(listOfLists); // valid call becase List is a subclass of Collection
withoutWildcard(listOfLists); // invalid call, does not compile because List does not match Collection
By the way, the snippet in your question is wrong. It should be
ComboBox<Order> box = new ComboBox<>();
If you don't specify the generic type in the declaration side, the compiler won't be able to infer the type of the diamond operator (<>
).