List of utility methods to do Collection Reverse
Collection | reverse(Collection collection) reverse LinkedList newCollection = new LinkedList(); Iterator i = collection.iterator(); while (i.hasNext()) { newCollection.addFirst(i.next()); return newCollection; |
Collection | reverse(Collection extends E> 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); |
List | reverse(Collection reverse List<T> output = new ArrayList<>(input); Collections.reverse(output); return output; |
Map | reverseMap(Map 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>(); ... |
Collection | reverseOrder(Collection 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>(); ... |