eclipse not inserting “diamond” operator in a java 8 project

后端 未结 6 655
轮回少年
轮回少年 2021-01-03 21:26

I have a maven project configured to use Java 8 and all works fine, eclipse compiles code like:

Map map = new HashMap<>();
         


        
6条回答
  •  时光取名叫无心
    2021-01-03 22:16

    Ok, it seems that different proposals are in different lists of suggestions, I think that diamond operator constructor is in "Java Non-type Proposals", while the one with arguments is in "Java Proposals". When both lists are included in the default suggestion list, the latter option goes first (though you can still press arrows to select the "diamond" one). The only option how to sort it so it was the first in the list (and hence get inserted by [ctrl+space, enter]) for me was disabling the other ones:

提交回复
热议问题