Interface ISet<V>
- All Superinterfaces:
ICollection<ISet<V>,
,V> Iterable<V>
,Predicate<V>
- All Known Subinterfaces:
ISortedSet<V>
- All Known Implementing Classes:
IntSet
,ISet.Mixin
,ISortedSet.Mixin
,LinearSet
,Set
,SortedSet
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
default boolean
containsAll
(IMap<V, ?> map) default boolean
containsAll
(ISet<V> set) default boolean
containsAny
(IMap<V, ?> map) default boolean
containsAny
(ISet<V> set) difference
(ISet<V> set) elements()
forked()
This returns a data structure which is forked, which is equivalent to Clojure's persistent data structures, also sometimes called functional or immutable.intersection
(ISet<V> set) default boolean
isLinear()
iterator
(long startIndex) linear()
This returns a data structure which is linear, or temporarily mutable.sliceIndices
(long startIndex, long endIndex) split
(int parts) Splits the collection into roughly even pieces, for parallel processing.default Spliterator
<V> stream()
default boolean
default Object[]
toArray()
default V[]
toArray
(IntFunction<V[]> allocator) toSet()
-
Method Details
-
valueHash
ToLongFunction<V> valueHash()- Returns:
- the hash function used by the set
-
valueEquality
BiPredicate<V,V> valueEquality()- Returns:
- the equality semantics used by the set
-
contains
- Returns:
- true, if the set contains
value
-
elements
-
zip
-
indexOf
- Returns:
- the position of
element
in the collection, if it's present
-
containsAll
-
containsAll
-
containsAny
-
containsAny
-
add
-
remove
-
iterator
-
spliterator
- Specified by:
spliterator
in interfaceIterable<V>
-
stream
-
union
-
difference
-
intersection
-
toSet
- Returns:
- the collection, represented as a normal Java set, which will throw
UnsupportedOperationException
on writes
-
toArray
- Returns:
- the elements of the list, in an array
-
toArray
- Parameters:
allocator
- a function which creates an array of the specified size- Returns:
- the elements of the list, in a typed array
-
isLinear
default boolean isLinear()- Specified by:
isLinear
in interfaceICollection<ISet<V>,
V> - Returns:
- true, if the set is linear
-
forked
Description copied from interface:ICollection
This returns a data structure which is forked, which is equivalent to Clojure's persistent data structures, also sometimes called functional or immutable. This is called "forked" because it means that multiple functions can make divergent changes to the data structure without affecting each other.If only a single function or scope uses the data structure, it can be left as a linear data structure, which can have significant performance benefits.
If the data structure is already forked, it will simply return itself.
- Specified by:
forked
in interfaceICollection<ISet<V>,
V> - Returns:
- a forked form of the data structure
-
linear
Description copied from interface:ICollection
This returns a data structure which is linear, or temporarily mutable. The term "linear", as used here, does not completely align with the formal definition of linear types as used in type theory. It is meant to describe the linear dataflow of the method calls, and as a converse to "forked" data structures.If
ICollection.forked()
is called on a linear collection, all references to that linear collection should be discarded.If the data structure is already linear, it will simply return itself.
- Specified by:
linear
in interfaceICollection<ISet<V>,
V> - Returns:
- a linear form of this data structure
-
sliceIndices
-
split
Description copied from interface:ICollection
Splits the collection into roughly even pieces, for parallel processing. Depending on the size and contents of the collection, this function may not return exactlyparts
subsets.- Specified by:
split
in interfaceICollection<ISet<V>,
V> - Parameters:
parts
- the target number of pieces- Returns:
- a list containing subsets of the collection.
-
test
-