MCPcopy Index your code
hub / github.com/bit4woo/ReSign / sortMapByKey

Method sortMapByKey

src/custom/CMapSort.java:11–26  ·  view source on GitHub ↗

ʹ�� Map��key�������� @param map @return

(Map<String, String> map, String sortMethod)

Source from the content-addressed store, hash-verified

9 * @return
10 */
11 public static Map<String, String> sortMapByKey(Map<String, String> map, String sortMethod) {
12 if (map == null || map.isEmpty()) {
13 return null;
14 }
15 if (sortMethod.equals("ASCENDING")){
16 Map<String, String> sortMap = new TreeMap<String, String>(new MapKeyComparator());
17 sortMap.putAll(map);
18 return sortMap;
19 }else if (sortMethod.equals("DESCENDING")) {
20 Map<String, String> sortMap = new TreeMap<String, String>(new MapKeyComparatorDesc());
21 sortMap.putAll(map);
22 return sortMap;
23 }else {
24 return null;
25 }
26 }
27
28 /**
29 * ʹ�� Map��value��������

Callers 3

mainMethod · 0.95
combineStringMethod · 0.80
combineStringMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected