How do I create some variable type alias in Java

后端 未结 5 1628
自闭症患者
自闭症患者 2020-12-03 09:12

let say I have this code

Map list = new HashMap();
list.put(\"number1\", \"one\");
list.put(\"number2\", \"two\")         


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-03 09:57

    Nothing like that exists in Java. You might be able to do something with IDE templates or autocompletion, and look forward to (limited) generics type inference in Java 7.

提交回复
热议问题