Use the cluster order to sort the given collection ids.

Implementation of the {@link OrderingResult} interface.
762307
@Override
  public ArrayModifiableDBIDs order(DBIDs ids) {
    ArrayModifiableDBIDs res = DBIDUtil.newArray(ids.size());
    for(DBIDIter it = this.ids.iter(); it.valid(); it.advance()) {
      if(ids.contains(it)) {
        res.add(it);
      }
    }
    return res;
  }
1051824
@Override
  public ORecordIteratorClusters<REC> last() {
    currentClusterIdx = clusterIds.length - 1;
    current.clusterPosition = liveUpdated ? database.countClusterElements(clusterIds[currentClusterIdx]) : lastClusterPosition + 1;
    return this;
  }
570369
public static <T> List<String> getUniqeDocIdList(List<T> results, Ordering<T> ordering, Function<T, String> toIdString) {
    Collections.sort(results, ordering);
    Set<String> list = Sets.newLinkedHashSet();
    for (T result : results) {
      list.add(toIdString.apply(result));
    }
    return Lists.newArrayList(list);
  }
462652
public void setClusterNodes(java.util.Collection<ClusterNode> clusterNodes) {
        if (clusterNodes == null) {
            this.clusterNodes = null;
            return;
        }

        this.clusterNodes = new com.amazonaws.internal.SdkInternalList<ClusterNode>(clusterNodes);
    }
203141
@Override
	protected List<IN> executeOnCollections(List<IN> inputData, RuntimeContext runtimeContext, ExecutionConfig executionConfig) {

		TypeInformation<IN> inputType = getInput().getOperatorInfo().getOutputType();

		int[] sortColumns = this.partitionOrdering.getFieldPositions();
		boolean[] sortOrderings = this.partitionOrdering.getFieldSortDirections();

		final TypeComparator<IN> sortComparator;
		if (inputType instanceof CompositeType) {
			sortComparator = ((CompositeType<IN>) inputType).createComparator(sortColumns, sortOrderings, 0, executionConfig);
		} else if (inputType instanceof AtomicType) {
			sortComparator = ((AtomicType) inputType).createComparator(sortOrderings[0], executionConfig);
		} else {
			throw new UnsupportedOperationException("Partition sorting does not support type "+inputType+" yet.");
		}

		Collections.sort(inputData, new Comparator<IN>() {
			@Override
			public int compare(IN o1, IN o2) {
				return sortComparator.compare(o1, o2);
			}
		});

		return inputData;
	}
495985
@SuppressWarnings("unchecked")
	public <T> UnsortedGrouping<T> getUnsortedGrouping(int id) {
		return verifyType(id, unsortedGroupings.get(id), SetType.UNSORTED_GROUPING);
	}
953219
public Sort sort() {
        SortField[] partitionKeySort = tokenMapper.sortFields();
        SortField[] clusteringKeySort = clusteringKeyMapper.sortFields();
        return new Sort(ArrayUtils.addAll(partitionKeySort, clusteringKeySort));
    }
59754
def sort(self, ids):
        
        def extract_int(string):
            """
            Extract an integer from the given string.

            :param string string: the identifier string
            :rtype: int
            """
            return int(re.sub(r"[^0-9]", "", string))

        tmp = list(ids)
        if self.algorithm == IDSortingAlgorithm.UNSORTED:
            self.log(u"Sorting using UNSORTED")
        elif self.algorithm == IDSortingAlgorithm.LEXICOGRAPHIC:
            self.log(u"Sorting using LEXICOGRAPHIC")
            tmp = sorted(ids)
        elif self.algorithm == IDSortingAlgorithm.NUMERIC:
            self.log(u"Sorting using NUMERIC")
            tmp = ids
            try:
                tmp = sorted(tmp, key=extract_int)
            except (ValueError, TypeError) as exc:
                self.log_exc(u"Not all id values contain a numeric part. Returning the id list unchanged.", exc, False, None)
        return tmp
853074
function (ordered) {
    var self = this;
    if (ordered) {
      return self.fetch();
    } else {
      var results = new LocalCollection._IdMap;
      self.forEach(function (doc) {
        results.set(doc._id, doc);
      });
      return results;
    }
  }
409428
public static List<RedisClusterNode> sortByLatency(Iterable<RedisClusterNode> clusterNodes) {

        List<RedisClusterNode> ordered = LettuceLists.newList(clusterNodes);
        ordered.sort(LatencyComparator.INSTANCE);
        return ordered;
    }
116725
public Query orderby(final Collection<? extends Expression> orderbyColumns) {
        if (orderbyColumns == null) {
            return this;
        }

        this.orderbyColumns.addAll(orderbyColumns);

        return this;
    }
50316
public void sortbyselection(List<String> sortFlds, List<Integer> sortDirs) {
		moveToId(-1);
		int i = 0;
		while (super.next()) {
			int minId = findSmallestFrom(i, sortFlds, sortDirs);
			if (minId != i) {
				swapRecords(i, minId);
			}
			moveToId(i);
			i++;
		}
	}
1240985
@Override
    public List<T> findAllById(Iterable<ID> ids) {
        Assert.notNull(ids, "Iterable ids should not be null");

        return operation.findByIds(ids, information.getJavaType(), information.getCollectionName());
    }
503235
private List<AggregationHashChain> sortAggregationHashChains(List<AggregationHashChain> chains) throws InvalidSignatureException {
        Collections.sort(chains, new Comparator<AggregationHashChain>() {
            public int compare(AggregationHashChain chain1, AggregationHashChain chain2) {
                return chain2.getChainIndex().size() - chain1.getChainIndex().size();
            }
        });
        return chains;
    }
942555
public void createIndex(String collectionName, List<String> columnList, int order)
    {
        DBCollection coll = mongoDb.getCollection(collectionName);

        List<DBObject> indexes = coll.getIndexInfo(); // List of all current
        // indexes on collection
        Set<String> indexNames = new HashSet<String>(); // List of all current
        // index names
        for (DBObject index : indexes)
        {
            BasicDBObject obj = (BasicDBObject) index.get("key");
            Set<String> set = obj.keySet(); // Set containing index name which
            // is key
            indexNames.addAll(set);
        }

        // Create index if not already created
        for (String columnName : columnList)
        {
            if (!indexNames.contains(columnName))
            {
                KunderaCoreUtils.printQuery("Create index on:" + columnName, showQuery);
                coll.createIndex(new BasicDBObject(columnName, order));
            }
        }
    }
1317073
public void setClusterInfoList(java.util.Collection<ClusterInfo> clusterInfoList) {
        if (clusterInfoList == null) {
            this.clusterInfoList = null;
            return;
        }

        this.clusterInfoList = new java.util.ArrayList<ClusterInfo>(clusterInfoList);
    }
514697
private static <V> Collection<V> sorted(Iterable<V> source, Comparator<V> comparator, int size)
    {
        V[] vs = (V[]) new Object[size];
        int i = 0;
        for (V v : source)
            vs[i++] = v;
        Arrays.sort(vs, comparator);
        return Arrays.asList(vs);
    }