stackoverflow のどこかで、2 つの値に関する解決策が見つかりました。
public class Pair<A, B> {
A first = null;
B second = null;
Pair(A first, B second) {
this.first = first;
this.second = second;
}
public A getFirst() {
return first;
}
public void setFirst(A first) {
this.first = first;
}
public B getSecond() {
return second;
}
public void setSecond(B second) {
this.second = second;
}
}
public static HashMap<Player, Pair<HorseModifier, LivingEntity>> P_and_h =
new HashMap<Player,Pair<HorseModifier, LivingEntity>>();;
そして質問:
P_and_h.put(p, new Pair(hm, hm.getHorse()));
if(P_and_h.containsValue(HorseModifier))` - dont working ( this is first object)