List of utility methods to do Set Sort
List | sort(Collection sort List<Entry<T, Integer>> sorted = new ArrayList<Entry<T, Integer>>(entrySet); Collections.sort(sorted, new Comparator<Entry<T, Integer>>() { @Override public int compare(Entry<T, Integer> o1, Entry<T, Integer> o2) { int i1 = o1.getValue(); int i2 = o2.getValue(); if (i1 < i2) return 1; ... |
List | sort(Set data) sort List list = new ArrayList(); for (Iterator it = data.iterator(); it.hasNext();) { list.add(it.next()); Collections.sort(list, (Object o1, Object o2) -> o1.toString().compareTo(o2.toString())); return list; |
List | sortByToCloseOrder(Set set) sort By To Close Order if (set == null) return new ArrayList(); List list = new ArrayList(set); Collections.sort(list); Collections.reverse(list); return list; |
String | sortedSetToString(SortedSet sortedSet) sorted Set To String String s = ""; if (sortedSet.size() == 0) return s; Iterator it = sortedSet.iterator(); while (it.hasNext()) { s += " " + (String) it.next(); return s.trim(); ... |
List | sortKeys(final Set sort Keys List<String> keys = new ArrayList<String>(); for (String key : keySet) { keys.add(key); Collections.sort(keys); return keys; |
List | sortKeys(Set sort Keys List<String> sortedKeys = new ArrayList<>(); sortedKeys.addAll(unsortedKeys); Collections.sort(sortedKeys); return sortedKeys; |
List | sortLong(Collection sort Long List<Entry<T, Long>> sorted = new ArrayList<Entry<T, Long>>(entrySet); Collections.sort(sorted, new Comparator<Entry<T, Long>>() { @Override public int compare(Entry<T, Long> o1, Entry<T, Long> o2) { long i1 = o1.getValue(); long i2 = o2.getValue(); if (i1 < i2) return 1; ... |