T
- Element typepublic final class Sorted<T> extends CollectionEnvelope<T>
Pay attention that sorting will happen on each operation
with the collection. Every time you touch it, it will fetch the
entire collection from the encapsulated object and sort it. If you
want to avoid that "side-effect", decorate it with
StickyCollection
.
There is no thread-safety guarantee.
Constructor and Description |
---|
Sorted(Comparator<T> cmp,
Collection<T> src)
Ctor.
|
Sorted(Comparator<T> cmp,
Iterable<T> src)
Ctor.
|
Sorted(Comparator<T> cmp,
Iterator<T> src)
Ctor.
|
Sorted(Comparator<T> cmp,
T... src)
Ctor.
|
Sorted(Iterable<T> src)
Ctor.
|
Sorted(T... src)
Ctor.
|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, parallelStream, removeIf, spliterator, stream
@SafeVarargs public Sorted(T... src)
src
- The underlying collectionpublic Sorted(Iterable<T> src)
If you're using this ctor you must be sure that type T
implements Comparable
interface. Otherwise, there will be
a type casting exception in runtime.
src
- The underlying collection@SafeVarargs public Sorted(Comparator<T> cmp, T... src)
src
- The underlying collectioncmp
- The comparatorpublic Sorted(Comparator<T> cmp, Iterator<T> src)
src
- The underlying collectioncmp
- The comparatorpublic Sorted(Comparator<T> cmp, Iterable<T> src)
src
- The underlying collectioncmp
- The comparatorpublic Sorted(Comparator<T> cmp, Collection<T> src)
src
- The underlying collectioncmp
- The comparatorCopyright © 2017–2018 Cactoos. All rights reserved.