Advertisement
ivana_andreevska

AV8 treeMap

Aug 16th, 2022
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. package AV8;
  2.  
  3. import java.util.Map;
  4. import java.util.TreeMap;
  5.  
  6. public class MapIntro {
  7.     public static void main(String[] args) {
  8.         //mpaite se parovi od kluc i vrednst
  9.         //genericka vrednost
  10.         //izbegnuva duplikati
  11.         //vo treemap klucot mora da e comparable
  12.         //se sortira spored klucot vo rastecki redosled
  13.         Map<String, String> treeMap = new TreeMap<>();
  14.         treeMap.put("FINKI", "FINKI");
  15.         treeMap.put("FinKI", "Finki");
  16.         treeMap.put("NP", "Napredno programiranje");
  17.         treeMap.put("F", "Fakultet");
  18.         treeMap.put("I", "Informaticki");
  19.  
  20.         System.out.println(treeMap);
  21.  
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement