Java Utililty Methods Collection Reverse

List of utility methods to do Collection Reverse

Description

The list of methods to do Collection Reverse are organized into topic(s).

Method

Collectionreverse(Collection collection)
reverse
LinkedList newCollection = new LinkedList();
Iterator i = collection.iterator();
while (i.hasNext()) {
    newCollection.addFirst(i.next());
return newCollection;
Collectionreverse(Collection c)
reverse
Object[] reverse = new Object[c.size()];
int index = c.size();
for (E e : c) {
    reverse[--index] = e;
return (List<E>) Arrays.asList(reverse);
Listreverse(Collection input)
reverse
List<T> output = new ArrayList<>(input);
Collections.reverse(output);
return output;
Map>reverseMap(Map> input)
reverse Map
Map<T, HashSet<T>> ret = new HashMap<T, HashSet<T>>();
for (Map.Entry<T, ? extends Collection<T>> entry : input.entrySet()) {
    final Collection<T> values = entry.getValue();
    final T key = entry.getKey();
    for (T value : values) {
        HashSet<T> newValues = ret.get(value);
        if (newValues == null) {
            newValues = new HashSet<T>();
...
CollectionreverseOrder(Collection objects)
reverse Order
Object[] reversed = new Object[objects.size()];
Iterator<K> iter = objects.iterator();
int i = objects.size() - 1;
while (iter.hasNext()) {
    reversed[i] = iter.next();
    i--;
Collection<K> reversedCollection = new ArrayList<K>();
...