Sorts a list of consumers into their execution order

@param consumers
@return
324767
public static List<RowProcessingConsumer> sortConsumers(List<RowProcessingConsumer> consumers) {
        final RowProcessingConsumerSorter sorter = new RowProcessingConsumerSorter(consumers);
        final List<RowProcessingConsumer> sortedConsumers = sorter.createProcessOrderedConsumerList();
        if (logger.isDebugEnabled()) {
            logger.debug("Row processing order ({} consumers):", sortedConsumers.size());
            int i = 1;
            for (RowProcessingConsumer rowProcessingConsumer : sortedConsumers) {
                logger.debug(" {}) {}", i, rowProcessingConsumer);
                i++;
            }
        }
        return sortedConsumers;
    }
1373944
@SafeVarargs
    public final ServerListenerBuilder addStartingCallbacks(Consumer<? super Server>... consumers) {
        return addStartingCallbacks(Arrays.asList(consumers));
    }
1256117
public static <T> Consumer<T> consumer(CheckedConsumer<T> consumer) {
        return Unchecked.consumer(consumer, Unchecked.RETHROW_ALL);
    }
757703
public static <T> Sequence<T> sort(final Sequence<T> sequence, final Comparator<T> comparator)
  {
    List<T> seqList = sequence.toList();
    Collections.sort(seqList, comparator);
    return simple(seqList);
  }
329920
public void produceResults(Consumer<T> consumer, ProducerContext context) {
    consumer.onNewResult((T) null, Consumer.IS_LAST);
  }
1111174
private void sortMethodList() {

        // order of execution is base classes first, then the order of
        // processorClasses, reversed for tear downs

        // build up the order:
        final List<Class<?>> hierarchy = new ArrayList<Class<?>>();

        if (initialisationClasses != null) {
            for (int i = initialisationClasses.length; i > 0; i--) {

                hierarchy.addAll(classHierarchyFor(initialisationClasses[i - 1]));
            }
        }
        sortMethodLists(hierarchy);
    }
1078617
public static void sort(final List<Artifact> targets) {
        int n = targets.size();
        while(n != 0){
            int newn = 0;

            for(int i = 1 ; i <= n-1 ; i++){
                if (targets.get(i-1).toString().compareTo(targets.get(i).toString()) > 0){
                    Collections.swap(targets, i - 1, i);
                    newn = i;
                }
            }

            n = newn;
        }
    }
1314626
private static <T> ArrayList<T> sorted(Collection<T> cls, Comparator<? super T> c) {
    ArrayList<T> sorted = new ArrayList<>(cls);
    sorted.sort(c);
    return sorted;
  }
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);
    }
95303
public void forEach(final IntObjConsumer<String> consumer)
    {
        int counterId = 0;

        final AtomicBuffer metaDataBuffer = this.metaDataBuffer;
        for (int i = 0, capacity = metaDataBuffer.capacity(); i < capacity; i += METADATA_LENGTH)
        {
            final int recordStatus = metaDataBuffer.getIntVolatile(i);

            if (RECORD_ALLOCATED == recordStatus)
            {
                consumer.accept(counterId, labelValue(metaDataBuffer, i));
            }
            else if (RECORD_UNUSED == recordStatus)
            {
                break;
            }

            counterId++;
        }
    }
633437
public void forEach(final CounterConsumer consumer)
    {
        int counterId = 0;

        final AtomicBuffer metaDataBuffer = this.metaDataBuffer;
        final AtomicBuffer valuesBuffer = this.valuesBuffer;

        for (int i = 0, capacity = metaDataBuffer.capacity(); i < capacity; i += METADATA_LENGTH)
        {
            final int recordStatus = metaDataBuffer.getIntVolatile(i);

            if (RECORD_ALLOCATED == recordStatus)
            {
                consumer.accept(
                    valuesBuffer.getLongVolatile(counterOffset(counterId)), counterId, labelValue(metaDataBuffer, i));
            }
            else if (RECORD_UNUSED == recordStatus)
            {
                break;
            }

            counterId++;
        }
    }
255580
public ServerListenerBuilder addStoppedCallbacks(Iterable<Consumer<? super Server>> consumers) {
        requireNonNull(consumers, "consumers");
        for (Consumer<? super Server> consumer : consumers) {
            serverStoppedCallbacks.add(requireNonNull(consumer, "consumer"));
        }
        return this;
    }
324294
public static <T> void forEach(Iterator<T> iterator, Consumer<T> consumer) {
		int index = 0;
		while (iterator.hasNext()) {
			consumer.accept(iterator.next(), index);
			index++;
		}
	}
1236129
public static Sort by(final List<Order> orders) {

    Assert.notNull(orders, "Orders must not be null!");

    return orders.isEmpty() ? Sort.unsorted() : new Sort(orders);
  }
1128297
public List<InputColumn<?>> getOutputColumns() {
        final List<InputColumn<?>> result = new ArrayList<>();
        for (final RowProcessingConsumer consumer : _consumers) {
            final InputColumn<?>[] outputColumns = consumer.getOutputColumns();
            for (final InputColumn<?> outputColumn : outputColumns) {
                result.add(outputColumn);
            }
        }
        return result;
    }
897491
@Override
    public final void closeConsumers() {
        final TaskRunner taskRunner = getTaskRunner();
        final List<RowProcessingConsumer> configurableConsumers = getConsumers();
        for (final RowProcessingConsumer consumer : configurableConsumers) {
            final TaskRunnable task = createCloseTask(consumer, null);
            taskRunner.run(task);
        }
    }
1146033
public static <T extends Comparable<T>> List<T> sorted(Iterable<T> items) {
    List<T> result = toList(items);
    Collections.sort(result);
    return result;
  }