import java.util.TreeMap;
public class Replace {
public static void main(String[] args) {
// TODO Auto-generated method stub
TreeMap<Integer, Integer> lhm1 = new TreeMap<>();
lhm1.put(10, 1);
lhm1.put(20, 2);
lhm1.put(30, 3);
lhm1.put(40, 4);
lhm1.put(50, 5);
System.out.println("Full-List : "+lhm1);
lhm1.replace(30, 30);
//System.out.println("pollFirstEntry() : "+ lhm1.pollFirstEntry());
System.out.println("Full-List after replace(k, v) ex-(30, 30) : "+lhm1);
System.out.println("after replace(k, oldV, newV) ex-(50, 5, 100) : "+lhm1.replace(50, 5, 100));
System.out.println("Full-List : "+lhm1);
}
}
No comments:
Post a Comment