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 list from the encapsulated object and sort it. If you
want to avoid that "side-effect", decorate it with
Sticky
.
There is no thread-safety guarantee.
Sticky
Constructor and Description |
---|
Sorted(Comparator<T> cmp,
Collection<T> src)
Ctor.
|
Sorted(Comparator<T> cmp,
T... src)
Ctor.
|
Sorted(Iterable<T> src)
Ctor.
|
Sorted(Iterator<T> src)
Ctor.
|
Sorted(T... src)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element) |
boolean |
addAll(int index,
Collection<? extends T> items) |
T |
get(int index) |
int |
indexOf(Object item) |
int |
lastIndexOf(Object item) |
ListIterator<T> |
listIterator() |
ListIterator<T> |
listIterator(int index) |
T |
remove(int index) |
T |
set(int index,
T element) |
List<T> |
subList(int start,
int end) |
String |
toString() |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, replaceAll, retainAll, size, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
@SafeVarargs public Sorted(T... src)
src
- The underlying collectionpublic Sorted(Iterator<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 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, Collection<T> src)
src
- The underlying collectioncmp
- The comparatorpublic final boolean addAll(int index, Collection<? extends T> items)
public final int lastIndexOf(Object item)
lastIndexOf
in interface List<T>
public final ListIterator<T> listIterator()
listIterator
in interface List<T>
public final ListIterator<T> listIterator(int index)
listIterator
in interface List<T>
public String toString()
toString
in class CollectionEnvelope<T>
Copyright © 2017–2019 Cactoos. All rights reserved.