Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java get keys from tree map

package com.java2novice.treemap;
 
import java.util.Set;
import java.util.TreeMap;
 
public class MyTreeMapKeys {
 
    public static void main(String a[]){
        TreeMap<String, String> hm = new TreeMap<String, String>();
        //add key-value pair to TreeMap
        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);
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: jdbc maven dependency 
Java :: How to efficiently find the first duplicate value in an array of ints between 1 and the n, with n being the size of the array? 
Java :: Do not treat position as fixed; only use immediately and call `holder.getAdapterPosition()` to look it up later 
Java :: check java version 
Java :: java initialize float to zero 
Java :: Traversing a double dimensional array 
Java :: firestore add to field array 
Java :: java initialize array with same value 
Java :: java only close socket outputstream 
Java :: localdate to timestamp in java 
Java :: java connect mariadb 
Java :: input string a list in java 
Java :: primefaces custom validator 
Java :: swing enter key 
Java :: java loop backwards through array 
Java :: java switch 
Java :: javafx filechooser specific file 
Java :: java read file bufferedreader 
Java :: gitignore java 
Java :: how to sort a list of integers in java 
Java :: cloning of list in java 
Java :: how to initialize an array in java 
Java :: ++i vs i++ java 
Java :: java output 
Java :: What is unreachable catch block error? 
Java :: java get constructor 
Java :: java int array 
Java :: java shutdown hook 
Java :: get certain character from string java 
Java :: event api spigot 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =