public static interface C.Set<T> extends Set<T>, C.Traversable<T>
C.Featured.Factory| Modifier and Type | Method and Description |
|---|---|
C.Set<T> |
accept(Lang.Visitor<? super T> visitor)
Iterate this
Traversable with a visitor function. |
C.Set<T> |
each(Lang.Visitor<? super T> visitor)
Alias of
C.Traversable.accept(Lang.Visitor) |
C.Set<T> |
eager()
Returns this traversable and turn off
C.Feature.LAZY |
C.Set<T> |
filter(Lang.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.Set<T> |
forEach(Lang.Visitor<? super T> visitor)
Alias of
C.Traversable.accept(Lang.Visitor) |
C.Set<T> |
lazy()
Returns this traversable and try to turn on
C.Feature.LAZY. |
C.Set<T> |
onlyIn(Collection<? extends T> col)
Returns a set contains all elements in the
col collection specified but not in this set |
C.Set<T> |
parallel()
Returns this traversable and try to turn on
C.Feature.PARALLEL. |
C.Set<T> |
sequential()
Returns this traversable and turn off
C.Feature.PARALLEL |
C.Set<T> |
with(Collection<? extends T> col)
Returns a set contains all elements in this set and all elements in the
col collection specified |
C.Set<T> |
with(T element)
Returns a set contains all elements in this set plus the element specified
|
C.Set<T> |
with(T element,
T... elements)
Returns a set contains all elements in this set plus all the elements specified in the parameter list
|
C.Set<T> |
withIn(Collection<? extends T> col)
Returns a set contains only elements in both
col collection specified and this set |
C.Set<T> |
without(Collection<? super T> col)
Returns a set contains all elements in this set and not in the
col collection specified |
C.Set<T> |
without(T element)
Returns a set contains all elements in the set except the one specified
|
C.Set<T> |
without(T element,
T... elements)
Returns a set contains all elements in the set except the ones specified
|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArrayparallelStream, removeIf, streamallMatch, anyMatch, collect, findOne, flatMap, isEmpty, map, noneMatch, reduce, reduce, sizefeatures, isC.Set<T> parallel()
C.TraversableReturns this traversable and try to turn on C.Feature.PARALLEL. If this traversable does not support C.Feature.PARALLEL then return this traversable directly without any state change
parallel in interface C.Traversable<T>C.Set<T> sequential()
C.TraversableReturns this traversable and turn off C.Feature.PARALLEL
sequential in interface C.Traversable<T>C.Set<T> lazy()
C.TraversableReturns this traversable and try to turn on C.Feature.LAZY. If lazy is not supported then return this traversable directly without any state change
lazy in interface C.Traversable<T>C.Set<T> eager()
C.TraversableReturns this traversable and turn off C.Feature.LAZY
eager in interface C.Traversable<T>C.Set<T> filter(Lang.Function<? super T,Boolean> predicate)
C.TraversableReturns an new traversable that contains all elements in the current traversable except that does not pass the test of the filter function specified.
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.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.C.Set<T> accept(Lang.Visitor<? super T> visitor)
C.TraversableIterate this Traversable 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 parallel
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.Set<T> each(Lang.Visitor<? super T> visitor)
C.TraversableAlias of C.Traversable.accept(Lang.Visitor)
each in interface C.Traversable<T>visitor - the visitor to tranverse the elementsTraversable instanceC.Set<T> forEach(Lang.Visitor<? super T> visitor)
C.TraversableAlias of C.Traversable.accept(Lang.Visitor)
forEach in interface C.Traversable<T>visitor - the visitor functionTraversable instanceC.Set<T> onlyIn(Collection<? extends T> col)
Returns a set contains all elements in the col collection specified but not in this set
col - the collection in which elements should be included from the result setC.Set<T> withIn(Collection<? extends T> col)
Returns a set contains only elements in both col collection specified and this set
col - the collection in which elements should be included from the result setC.Set<T> without(Collection<? super T> col)
Returns a set contains all elements in this set and not in the col collection specified
col - the collection in which elements should be excluded from the result setC.Set<T> with(Collection<? extends T> col)
Returns a set contains all elements in this set and all elements in the col collection specified
col - the collection in which elements should be included in the result setC.Set<T> with(T element)
Returns a set contains all elements in this set plus the element specified
element - the new element that will be contained in the returning setC.Set<T> with(T element, T... elements)
Returns a set contains all elements in this set plus all the elements specified in the parameter list
element - the first element to be added into the returning setelements - rest elements to be added into the returning setC.Set<T> without(T element)
Returns a set contains all elements in the set except the one specified
element - the element that should not be in the resulting setC.Set<T> without(T element, T... elements)
Returns a set contains all elements in the set except the ones specified
element - the element that should not be in the resulting setelements - the array contains elements that should not be in the resulting setCopyright © 2014–2021 OSGL (Open Source General Library). All rights reserved.