List of utility methods to do List Sort
int[] | ListToSortedArray(List Convert a List of Integer s to a sorted array of int s.
if (list == null) { return null; int count = list.size(); int[] result = new int[count]; int last = Integer.MIN_VALUE; boolean needsSorting = false; for (int i = 0; i < count; ++i) { ... |
LinkedList | mapTosortedScoreList(HashMap This function creates a sorted list using the maps LinkedList<Entry<Long, Double>> mapList = new LinkedList<Entry<Long, Double>>(unSortedMap.entrySet()); Collections.sort(mapList, new Comparator<Entry<Long, Double>>() { @Override public int compare(Entry<Long, Double> o1, Entry<Long, Double> o2) { return o2.getValue().compareTo(o1.getValue()); }); return mapList; ... |
Double | maximum(List Get the maximum value thru linear interpolations return interpolateLinearlyQuantile(sortedDataAscendingOrder, (double) 1); |
List | mergeLong(List merge Long Set<Long> set = new HashSet<Long>(l1); set.addAll(l2); List<Long> res = new ArrayList<Long>(set); if (sort) { Collections.sort(res); return res; |
List | mergeSort(List To sort a given List of values.Sorting algorithm: MergeSort. Operates: Recursively. More information: http://en.wikipedia.org/wiki/Merge_sort if (m.size() <= 1) { return m; int middle = m.size() / 2; List<E> left = m.subList(0, middle); List<E> right = m.subList(middle, m.size()); right = mergeSort(right); left = mergeSort(left); ... |
List | mergeSort(List MergeSorts the given list. if (list.size() <= 1) { return list; } else { int half = list.size() / 2; List<K> left = mergeSort(subList(list, 0, half - 1)); List<K> right = mergeSort(subList(list, half, list.size() - 1)); return merge(left, right); |
void | mergeSortedLists(List Merge two sorted Lists I could have used the Java Set collection here...unfortunately the only ordered set is their TreeSet, and set union/subtraction therefore take NlogN with a pretty big constant overhead. int numSrc = 0; for (int i = 0; i < src.length; i++) { if (src[i] != null) { numSrc++; if (numSrc == 1) { for (int i = 0; i < src.length; i++) { ... |
void | quickSort(Comparable[] list, int min, int max) Performs a quick sort on the given array of Comparable objects between the min and maximum range. Arrays.sort(list, min, max + 1); |
boolean | removeSortByColumnName(List remove Sort By Column Name if (sortProperty == null) { return false; int index = -1; for (int i = 0, size = sortProperty.size(); i < size; i++) { String sort = sortProperty.get(i); if (sort.equals(columnName)) { index = i; ... |
void | removeSortColumns(List remove Sort Columns List<String> removedSorts = new ArrayList<String>(); for (String sort : sorts) { if (!selectColumns.contains(sort)) { removedSorts.add(sort); for (String sort : removedSorts) { removeSortByColumnName(sorts, ascending, sort); ... |