“Java Treemap -Beispiel” Code-Antworten

Java Treemap Beispiel Navigablemap

import java.util.*;  
class Navigable_Tree_Map{  
public static void main(String args[]){  
   NavigableMap<Integer,String> map=new TreeMap<Integer,String>();    
      map.put(93,"Afghanistan");    
      map.put(213,"Algeria");    
      map.put(55,"Brazil");    
      map.put(33,"France"); 
      map.put(49,"Germany"); 
      map.put(354,"Iceland"); 
     
      System.out.println("Navigable Map in Decending Order: "+map.descendingMap());  
  
      System.out.println("Navigable Map using headMap() method: "+map.headMap(49,true));  
  
      System.out.println("Navigable Map using tailMap() method: "+map.tailMap(49,true));
 
      System.out.println("Navigable Map using subMap() method: "+map.subMap(33, false, 55, true));   
}  
}
Outrageous Ostrich

Java Treemap -Beispiel

import java.util.*;  
class Tree_Map{  
public static void main(String args[]){  
   TreeMap<Integer,String> map=new TreeMap<Integer,String>();    
      map.put(93,"Afghanistan");    
      map.put(213,"Algeria");    
      map.put(55,"Brazil");       
        
      for(Map.Entry mapTree:map.entrySet()){    
       System.out.println(mapTree.getKey()+" "+mapTree.getValue());    
      }    
}  
}
Unsightly Unicorn

Ähnliche Antworten wie “Java Treemap -Beispiel”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen