Created
September 29, 2015 22:50
-
-
Save koher/e3669bc5a2c391b43f6c to your computer and use it in GitHub Desktop.
TreeMap#get gets ClassCastException
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
Map<String, Integer> map = new TreeMap(); | |
map.put("abc", 123); | |
map.put("def", 456); | |
map.put("ghi", 789); | |
map.get("abc"); | |
map.get(123); // java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment