Check out example codes for "how to get all the elements in Hashtable java". It will help you in understanding the concepts better.

Code Example 1

// Using hashtable.keySet()

package com.java2novice.hashtable;
 
import java.util.Hashtable;
import java.util.Set;
 
public class MyHashtableKeys {
 
    public static void main(String a[]){
        Hashtable<String, String> hm = new Hashtable<String, String>();
        //add key-value pair to Hashtable
        hm.put("first", "FIRST INSERTED");
        hm.put("second", "SECOND INSERTED");
        hm.put("third","THIRD INSERTED");
        System.out.println(hm);
        Set<String> keys = hm.keySet();
        for(String key: keys){
            System.out.println(key);
        }
    }
}

Learn ReactJs, React Native from akashmittal.com