public class Set<V> extends ISet.Mixin<V>
Map
, and shares the same performance characteristics.ISet.Durable<V>, ISet.Mixin<V>
Modifier and Type | Field and Description |
---|---|
static Set |
EMPTY |
hash
Constructor and Description |
---|
Set() |
Set(ToLongFunction<V> hashFn,
BiPredicate<V,V> equalsFn) |
Modifier and Type | Method and Description |
---|---|
Set<V> |
add(V value) |
Set<V> |
add(V value,
Object editor) |
Set<V> |
clone() |
boolean |
contains(V value) |
Set<V> |
difference(ISet<V> s) |
static <V> Set<V> |
empty() |
boolean |
equals(Object obj) |
Set<V> |
forked()
This returns a data structure which is forked, which is equivalent to Clojure's persistent
data structures, also sometimes called functional or immutable.
|
static <V> Set<V> |
from(ISet<V> s) |
static <V> Set<V> |
from(Iterable<V> iterable) |
static <V> Set<V> |
from(Iterator<V> iterator) |
OptionalLong |
indexOf(V element) |
Set<V> |
intersection(ISet<V> s) |
boolean |
isLinear() |
Iterator<V> |
iterator() |
Set<V> |
linear()
This returns a data structure which is linear, or temporarily mutable.
|
V |
nth(long idx) |
static <V> Set<V> |
of(V... elements) |
Set<V> |
remove(V value) |
Set<V> |
remove(V value,
Object editor) |
long |
size() |
List<Set<V>> |
split(int parts)
Splits the collection into roughly even pieces, for parallel processing.
|
Set<V> |
union(ISet<V> s) |
BiPredicate<V,V> |
valueEquality() |
ToLongFunction<V> |
valueHash() |
<U> Map<V,U> |
zip(Function<V,U> f) |
hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, containsAll, containsAny, containsAny, diff, elements, iterator, sliceIndices, spliterator, stream, test, toArray, toArray, toSet
nth, save
public static final Set EMPTY
public Set()
public Set(ToLongFunction<V> hashFn, BiPredicate<V,V> equalsFn)
hashFn
- the hash function used by the setequalsFn
- the equality semantics used by the setpublic static <V> Set<V> from(ISet<V> s)
s
- a setpublic static <V> Set<V> from(Iterator<V> iterator)
iterator
- an iteratorpublic static <V> Set<V> from(Iterable<V> iterable)
iterable
- an Iterable
objectpublic static <V> Set<V> of(V... elements)
public static <V> Set<V> empty()
public boolean isLinear()
public ToLongFunction<V> valueHash()
public BiPredicate<V,V> valueEquality()
public boolean contains(V value)
value
public long size()
public OptionalLong indexOf(V element)
element
in the collection, if it's presentpublic V nth(long idx)
idx
public List<Set<V>> split(int parts)
ICollection
parts
subsets.parts
- the target number of piecespublic <U> Map<V,U> zip(Function<V,U> f)
f
, for each element in the setpublic Set<V> difference(ISet<V> s)
set
public Set<V> intersection(ISet<V> s)
set
public Set<V> forked()
ICollection
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.
public Set<V> linear()
ICollection
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.
public boolean equals(Object obj)
equals
in class ISet.Mixin<V>
public Set<V> clone()
clone
in interface ICollection<ISet<V>,V>
clone
in class ISet.Mixin<V>