I know this question has been treated before but I've read questions and tried to fix my own with no result, I think I'm missing something with the TreeMap or Map implementation...
if(arme != null){
if(!hommesArmes.containsKey(arme)){
System.out.println(hommesArmes.containsKey(arme));
hommesArmes.put(arme, new TreeSet<Homme>());
System.out.println(hommesArmes.containsKey(arme));
}
hommesArmes.get(arme).add(homme);
}
Why do I get false twice when I run this? I've tried with Integer instead of Arme and it worked, I don't understand what I'm doing wrong.
我传递给TreeMap的构造函数的Comparator对象有问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.