I'm new to Java. While coding a Map<>, I found out that declaring Map<int, int>
is a syntax error while Map<Integer, Integer>
is OK. Is it only possible in Java to instantiate generics over object types, as opposed to primitives? If so, is there a noticeable performance penalty for boxing/unboxing of primitives?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…