Friday, 20 January 2017

HashTable : Remove


import java.util.*;

public class Remove {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
       
        Hashtable<String, Integer> lhm1 = new Hashtable<>();
        lhm1.put("One", 1);
        lhm1.put("Two", 2);
        lhm1.put("Three", 3);
        lhm1.put("Four", 4);
        lhm1.put("Five", 5);
        lhm1.put("Six", 6);
        lhm1.put("Seven", 7);
        lhm1.put("Eight", 8);
       
        System.out.println("Full-List : "+lhm1);
        System.out.println("Full-List : "+lhm1.remove("Four"));
        System.out.println("Full-List : "+lhm1);
       
        System.out.println("Full-List : "+lhm1.remove("Two", 2));
        System.out.println("Full-List : "+lhm1);
       
    }
}

No comments:

Post a Comment