let say I have this code
Map<String, String> list = new HashMap<String, String>();
list.put("number1", "one");
list.put("number2", "two");
how can I make some "alias" the type
Map<String, String>
to something that easier to be rewritten like
// may be something like this
theNewType = HashMap<String, String>;
theNewType list = new theNewType();
list.put("number1", "one");
list.put("number2", "two");
basically my question is, how to create "alias" to some "type", so i can make it easier to write and easier when need to change the whole program code.
Thanks, and sorry if this is silly question. I'm kinda new in Java.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…