public static interface C.ListOrSet<T> extends C.List<T>, C.Set<T>
C.List.Cursor<T>C.Featured.Factory| Modifier and Type | Method and Description |
|---|---|
C.ListOrSet<T> |
accept(Osgl.Function<? super T,?> visitor)
Iterate this
Traversable with a visitor function. |
C.ListOrSet<T> |
each(Osgl.Function<? super T,?> visitor)
Alias of
C.Traversable.accept(Osgl.Function) |
C.ListOrSet<T> |
eager()
Returns this traversable and make sure
C.Feature.LAZY is unset |
C.ListOrSet<T> |
filter(Osgl.Function<? super T,Boolean> predicate)
Returns an new traversable that contains all elements in the current traversable
except that does not pass the test of the filter function specified.
|
C.ListOrSet<T> |
forEach(Osgl.Function<? super T,?> visitor)
Alias of
C.Traversable.accept(Osgl.Function) |
C.ListOrSet<T> |
lazy()
Returns this traversable and make sure
C.Feature.LAZY is set |
<R> C.ListOrSet<R> |
map(Osgl.Function<? super T,? extends R> mapper)
Returns an new traversable with a mapper function specified.
|
C.ListOrSet<T> |
parallel()
Returns this traversable and make sure
C.Feature.PARALLEL is set |
C.ListOrSet<T> |
sequential()
Returns this traversable and make sure
C.Feature.PARALLEL is unset |
C.ListOrSet<T> |
without(Collection<? super T> col)
Returns a List contains all elements in this List and not in
the
col collection specified |
C.ListOrSet<T> |
without(T element)
Returns a list contains all elements in the list except the
one specified
|
C.ListOrSet<T> |
without(T element,
T... elements)
Returns a list contains all elements in the list except the
ones specified
|
accept, acceptLeft, acceptLeft, acceptRight, acceptRight, addAll, append, append, append, copy, drop, dropWhile, each, flatMap, forEach, head, insert, insert, insert, locate, locateFirst, locateLast, prepend, prepend, prepend, readOnly, remove, reverse, snapshot, sorted, sorted, split, subList, tail, tail, take, takeWhile, unique, unique, zip, zipAll, zipWithIndexadd, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArrayappend, findLast, last, prepend, reduceRight, reduceRight, reverseIterator, zip, zipAllappend, append, append, append, count, findFirst, first, head, prepend, prepend, prepend, prepend, reduce, reduce, reduceLeft, reduceLeft, zip, zipAllallMatch, anyMatch, findOne, isEmpty, noneMatch, sizefeatures, isadd, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArrayparallelStream, removeIf, streamC.ListOrSet<T> parallel()
C.ListC.Feature.PARALLEL is setparallel in interface C.List<T>parallel in interface C.ReversibleSequence<T>parallel in interface C.Sequence<T>parallel in interface C.Set<T>parallel in interface C.Traversable<T>C.ListOrSet<T> sequential()
C.ListC.Feature.PARALLEL is unsetsequential in interface C.List<T>sequential in interface C.ReversibleSequence<T>sequential in interface C.Sequence<T>sequential in interface C.Set<T>sequential in interface C.Traversable<T>C.ListOrSet<T> lazy()
C.ListC.Feature.LAZY is setlazy in interface C.List<T>lazy in interface C.ReversibleSequence<T>lazy in interface C.Sequence<T>lazy in interface C.Set<T>lazy in interface C.Traversable<T>C.ListOrSet<T> eager()
C.ListC.Feature.LAZY is unseteager in interface C.List<T>eager in interface C.ReversibleSequence<T>eager in interface C.Sequence<T>eager in interface C.Set<T>eager in interface C.Traversable<T>C.ListOrSet<T> accept(Osgl.Function<? super T,?> visitor)
C.TraversableTraversable with a visitor function. This method
does not specify the approach to iterate through this structure. The
implementation might choose iterate from left to right, or vice versa.
It might even choose to split the structure into multiple parts, and
iterate through them in parallelaccept in interface C.List<T>accept in interface C.ReversibleSequence<T>accept in interface C.Sequence<T>accept in interface C.Set<T>accept in interface C.Traversable<T>visitor - a function that apply to element in this
Traversable. The return value
of the function is ignoredTraversable instance for chained callC.ListOrSet<T> each(Osgl.Function<? super T,?> visitor)
C.TraversableC.Traversable.accept(Osgl.Function)each in interface C.List<T>each in interface C.ReversibleSequence<T>each in interface C.Sequence<T>each in interface C.Set<T>each in interface C.Traversable<T>visitor - the visitor to tranverse the elementsTraversable instanceC.ListOrSet<T> forEach(Osgl.Function<? super T,?> visitor)
C.TraversableC.Traversable.accept(Osgl.Function)forEach in interface C.List<T>forEach in interface C.ReversibleSequence<T>forEach in interface C.Sequence<T>forEach in interface C.Set<T>forEach in interface C.Traversable<T>visitor - the visitor functionTraversable instanceC.ListOrSet<T> filter(Osgl.Function<? super T,Boolean> predicate)
C.Sequence
Traversable traversable = C.list(-1, 0, 1, -3, 7);
Traversable filtered = traversable.filter(_.F.gt(0));
assertTrue(filtered.contains(1));
assertFalse(filtered.contains(-3));
filter in interface C.List<T>filter in interface C.ReversibleSequence<T>filter in interface C.Sequence<T>filter in interface C.Set<T>filter in interface C.Traversable<T>predicate - the function that test if the element in the traversable should be
kept in the resulting traversable. When applying the filter function
to the element, if the result is true then the element will
be kept in the resulting traversable.Sequence consists of elements that passed the predicateC.ListOrSet<T> without(Collection<? super T> col)
C.Listcol collection specifiedC.ListOrSet<T> without(T element)
C.ListC.ListOrSet<T> without(T element, T... elements)
C.List<R> C.ListOrSet<R> map(Osgl.Function<? super T,? extends R> mapper)
C.Sequence
Traversable traversable = C.list(23, _.NONE, null);
assertEquals(C.list(true, false, false), traversal.map(_.F.NOT_NULL));
assertEquals(C.list("23", "", ""), traversal.map(_.F.AS_STRING));
For Lazy Traversable, it must use lazy evaluation for this method. Otherwise it is up to implementation to decide whether use lazy evaluation or not
map in interface C.List<T>map in interface C.ReversibleSequence<T>map in interface C.Sequence<T>map in interface C.Traversable<T>R - the element type of the new traversalmapper - the function that applied to element in this traversal and returns element in the result traversalR that are mapped from this sequenceCopyright © 2017. All Rights Reserved.