を使用していHashMap<Integer, ArrayList>
ます。私のArrayList
では、2 番目の要素は、int
それを 1 ずつ増やす必要がある です。どうすればこれを達成できますか?
public class IncrementAge {
/** integer is key; value is ArrayList. */
Map<Integer, ArrayList> idNumber = new HashMap<Integer, ArrayList>();
/** array that contains name and age (only two elements). */
ArrayList<> person = new ArrayList();
/** name is 1st(0) element in array while age is second(1) element. */
this.person.add(0, "jose");
this.person.add(1, 32);
/** place this object in hashMap with key=0; obj=person. */
idNumber.put(0, this.person);
}
idNumber
のキー値に基づいて、このオブジェクトの年齢をどのようにインクリメントすればよいHashSet
ですか?