General syntax character <~>

Working with an IDE, such as NetBeans or IDEA, I saw that they convert common types to this character:

 private final List<String> ar = new ArrayList<~>(); 

But using this in a simple editor leads to an error. By the way, Eclipse also does not like. Is this related to the type erasure mechanism?

+4
source share
1 answer

You will see that in IntelliJ it is a different color!

This is because he used code folding to hide the code, but you cannot write it that way in Java 6.

In Java 7 you can write

 private final List<String> ar = new ArrayList<>(); 
+11
source

Source: https://habr.com/ru/post/1403996/


All Articles