0

please help me i am kinda stuck in this code.. im new to maven/ apache commons.. i have this code working on my program sorting an element of a LinkedHashMap / OrderedMap I want to refactor this same code to use the Apache Commons API.. what should i use? Thank You

Here is the code

Set<Map.Entry<String, String>> foundSet = MainProgram.cellData.entrySet(); List<Map.Entry<String, String>> foundListEntry = new ArrayList<Map.Entry<String, String>>(foundSet); Collections.sort(foundListEntry, new Comparator<Map.Entry<String, String>>() { public int compare(Entry<String, String> es1, Entry<String, String> es2) { return es1.getKey().compareTo(es2.getKey()); } }); MainProgram.cellData.clear(); for(Map.Entry<String, String> map : foundListEntry) { MainProgram.cellData.put(map.getKey(), map.getValue()); } System.out.println("\nThe table has been Successfuly Sorted!\n"); updateData(); menuPrint(); 
2

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.