Finds all documents which match with the given example, then apply the given sort to results

@param example
example object to construct query with
@param sort
sort object to sort results
@param <S>
@return sorted iterable of all matching documents
2106
@Override
	public <S extends T> Iterable<S> findAll(final Example<S> example, final Sort sort) {
		final ArangoCursor cursor = findAllInternal(sort, example, new HashMap());
		return cursor;
	}
402378
def sorts_query(sortables):
        

        stmts = []

        for sortable in sortables:
            if sortable.desc:
                stmts.append('{} DESC'.format(sortable.field))
            else:
                stmts.append('{} ASC'.format(sortable.field))

        return ' ORDER BY {}'.format(', '.join(stmts))
1369761
public static <A, B extends Comparable<B>> Map<A, B> sortByValue(Map<A, B> map) {
    List<Map.Entry<A, B>> list = Lists.newArrayList(map.entrySet());
    Collections.sort(list, new Comparator<Map.Entry<A, B>>() {
      public int compare(Map.Entry<A, B> o1, Map.Entry<A, B> o2) {
        return o1.getValue().compareTo(o2.getValue());
      }
    });
    return listToMap(list);
  }
696970
public static String exampleOrderBy(Class<?> entityClass) {
        StringBuilder sql = new StringBuilder();
        sql.append("<if test=\"orderByClause != null\">");
        sql.append("order by ${orderByClause}");
        sql.append("</if>");
        String orderByClause = EntityHelper.getOrderByClause(entityClass);
        if (orderByClause.length() > 0) {
            sql.append("<if test=\"orderByClause == null\">");
            sql.append("ORDER BY " + orderByClause);
            sql.append("</if>");
        }
        return sql.toString();
    }
1235691
public <T extends Comparable<? super T>> List<T> sort (Iterator<T> iter)
    {
        ArrayList<T> list = new ArrayList<T>();
        CollectionUtil.addAll(list, iter);
        return sort(list);
    }
394093
function sortBy(collection, evaluator) {
        var array = map(collection, function(item){return item})
        array.sort(function(a,b){
          var aValue = evaluator(a),
              bValue = evaluator(b)
          return aValue==bValue ? 0 : (aValue>bValue ? 1 : -1)
        })
        var sortedCollection = map(array, function(item){return item}, features.newCollection, features.append)
        return sortedCollection
      }
412082
public void selectExample(final WComponent example, final String exampleName) {
		WComponent currentExample = container.getChildAt(0).getParent();

		if (currentExample != null && currentExample.getClass().equals(example.getClass())) {
			// Same example selected, do nothing
			return;
		}

		resetExample();
		container.removeAll();

		this.getDecoratedLabel().setBody(new WText(exampleName));

		WApplication app = WebUtilities.getAncestorOfClass(WApplication.class, this);
		if (app != null) {
			app.setTitle(exampleName);
		}

		if (example instanceof ErrorComponent) {
			tabset.getTab(0).setText("Error");
			source.setSource(null);
		} else {
			String className = example.getClass().getName();
			WDefinitionList list = new WDefinitionList(WDefinitionList.Type.COLUMN);
			container.add(list);
			list.addTerm("Example path", new WText(className.replaceAll("\\.", " / ")));
			list.addTerm("Example JavaDoc", new JavaDocText(getSource(className)));
			container.add(new WHorizontalRule());
			tabset.getTab(0).setText(example.getClass().getSimpleName());
			source.setSource(getSource(className));
		}

		container.add(example);
		example.setLocked(true);
	}
546622
public static <T extends Comparable<? super T>> ArrayList<T> sortThis(ArrayList<T> list)
    {
        return ArrayListIterate.sortThis(list, Comparators.naturalOrder());
    }
1052515
public static Iterable<MatchResult> findMatches(Pattern pattern, CharSequence s) {
		List<MatchResult> results = new ArrayList<MatchResult>();

		for (Matcher m = pattern.matcher(s); m.find();)
			results.add(m.toMatchResult());

		return results;
	}

	/**
	 * Sorts a given HashMap using a custom function
	 * @param m Map of items to sort
	 * @return sorted List of items
	 */
    public static List<Pattern> sortByValue(final HashMap<Pattern,String> m) {
        List<Pattern> keys = new ArrayList<Pattern>();
        keys.addAll(m.keySet());
        Collections.sort(keys, new Comparator<Object>() {
            @SuppressWarnings({ "unchecked", "rawtypes" })
			public int compare(Object o1, Object o2) {
                Object v1 = m.get(o1);
                Object v2 = m.get(o2);
                if (v1 == null) {
                    return (v2 == null) ? 0 : 1;
                } else if (v1 instanceof Comparable) {
                    return ((Comparable) v1).compareTo(v2);
                } else {
                    return 0;
                }
            }
        });
        return keys;
    }
}
32469
public static <T extends Extendable> List<T> sortAndGroup(final List<T> values, final Group[] groups, final Sort sort, final boolean ascending) {
        List<T> list = sort(values, sort, ascending);
        list = group(list, groups);
        return list;
    }
114571
public static <T extends Comparable<? super T>> List<T> sortInplace(List<T> list) {
		Collections.sort(list);
		return list;
	}
1092381
public List<Object> sortAndFilter() {
        final List filteredList = getFilteredValue();
        filteredList.clear();
        rowMap = new HashMap<>();
        rowNumbers = new HashMap<>();

        final Collection<?> values = (Collection<?>) getValue();
        if (values == null || values.isEmpty()) {
            return filteredList;
        }

        remapRows();

        boolean filters = false;
        for (final SheetColumn col : getColumns()) {
            if (!LangUtils.isValueBlank(col.getFilterValue())) {
                filters = true;
                break;
            }
        }

        final FacesContext context = FacesContext.getCurrentInstance();
        final Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
        final String var = getVar();

        if (filters) {
            // iterate and add those matching the filters
            for (final Object obj : values) {
                requestMap.put(var, obj);
                if (matchesFilter(obj)) {
                    filteredList.add(obj);
                }
            }
        }
        else {
            filteredList.addAll(values);
        }

        final ValueExpression veSortBy = getValueExpression(PropertyKeys.sortBy.name());
        if (veSortBy != null) {
            Collections.sort(filteredList, new BeanPropertyComparator(veSortBy, var, convertSortOrder(), null,
                        isCaseSensitiveSort(), Locale.ENGLISH, getNullSortOrder()));
        }

        // map filtered rows
        remapFilteredList(filteredList);
        return filteredList;
    }
581003
@Override
    protected final List<Description> orderItems(Collection<Description> descriptions) {
        /*
         * In practice, we will never get here--Sorters do their work in the
         * compare() method--but the Liskov substitution principle demands that
         * we obey the general contract of Orderable. Luckily, it's trivial to
         * implement.
         */
        List<Description> sorted = new ArrayList<Description>(descriptions);
        Collections.sort(sorted, this); // Note: it would be incorrect to pass in "comparator"
        return sorted;
    }
920260
public static List<Example> asList( Example example )
    {
        if (example == null) return new ArrayList<Example>();

        List<Example> all = new ArrayList<Example>();
        for (Example each : example)
        {
            all.add( each );
        }
        return all;
    }
571366
@Override
    public ListT<W,T> sorted(final Comparator<? super T> c) {

        return (ListT<W,T>) FoldableTransformerSeq.super.sorted(c);
    }
12874
protected void appendSort(SolrQuery solrQuery, @Nullable Sort sort, @Nullable Class<?> domainType) {

		if (sort == null) {
			return;
		}

		for (Order order : sort) {
			solrQuery.addSort(getMappedFieldName(order.getProperty(), domainType),
					order.isAscending() ? ORDER.asc : ORDER.desc);
		}
	}
895900
public List<GridFSDBFile> find(final DBObject query, final DBObject sort, final int firstResult,
            final int maxResult)
    {
        List<GridFSDBFile> files = new ArrayList<GridFSDBFile>();

        DBCursor c = null;
        try
        {
            c = getFilesCollection().find(query);
            if (sort != null)
            {
                c.sort(sort);
            }
            c.skip(firstResult).limit(maxResult);
            while (c.hasNext())
            {
                files.add(findOne(c.next()));
            }
        }
        finally
        {
            if (c != null)
            {
                c.close();
            }
        }
        return files;
    }