@Override public int compare(T o1, T o2) { Set<Sort> params = identityQuery.getSorting(); int sortResult = 0; if (params != null) { for (Sort sort : params) { QueryParameter queryParameter = sort.getParameter(); sortResult = sortByQueryParameter(queryParameter, o1, o2); if (sortResult != 0) { // Negate result if descending order is required if (!sort.isAscending()) { return -sortResult; } return sortResult; } } } return sortResult; }
Collections.sort(result, new FileSortingComparator<V>(identityQuery));
Collections.sort(result, new FileSortingComparator<V>(identityQuery));
@Override public int compare(T o1, T o2) { Set<Sort> params = identityQuery.getSorting(); int sortResult = 0; if (params != null) { for (Sort sort : params) { QueryParameter queryParameter = sort.getParameter(); sortResult = sortByQueryParameter(queryParameter, o1, o2); if (sortResult != 0) { // Negate result if descending order is required if (!sort.isAscending()) { return -sortResult; } return sortResult; } } } return sortResult; }