Class SortedSet<V>
java.lang.Object
io.lacuna.bifurcan.ISet.Mixin<V>
io.lacuna.bifurcan.ISortedSet.Mixin<V>
io.lacuna.bifurcan.SortedSet<V>
- All Implemented Interfaces:
ICollection<ISet<V>,
,V> ISet<V>
,ISortedSet<V>
,Iterable<V>
,Predicate<V>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.lacuna.bifurcan.ISet
ISet.Mixin<V>
Nested classes/interfaces inherited from interface io.lacuna.bifurcan.ISortedSet
ISortedSet.Bound, ISortedSet.Mixin<V>
-
Field Summary
Fields inherited from class io.lacuna.bifurcan.ISet.Mixin
hash
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
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.inclusiveFloorIndex
(V val) boolean
isLinear()
linear()
This returns a data structure which is linear, or temporarily mutable.nth
(long idx) long
size()
Methods inherited from class io.lacuna.bifurcan.ISortedSet.Mixin
clone
Methods inherited from class io.lacuna.bifurcan.ISet.Mixin
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.lacuna.bifurcan.ICollection
iterator, nth
Methods inherited from interface io.lacuna.bifurcan.ISet
containsAll, containsAll, containsAny, containsAny, iterator, split, spliterator, stream, test, toArray, toArray, toSet
Methods inherited from interface io.lacuna.bifurcan.ISortedSet
ceil, ceilIndex, difference, first, floor, floorIndex, floorIndex, intersection, last, sliceIndices, union
-
Constructor Details
-
SortedSet
public SortedSet() -
SortedSet
-
-
Method Details
-
comparator
-
inclusiveFloorIndex
- Returns:
- the entry whose key is either equal to
key
, or just below it. Ifkey
is less than the minimum value in the map, returnsnull
.
-
ceilIndex
- Returns:
- the entry whose key is either equal to
key
, or just above it. Ifkey
is greater than the maximum value in the map, returnsnull
.
-
add
-
remove
-
zip
-
valueHash
- Returns:
- the hash function used by the set
-
valueEquality
- Returns:
- the equality semantics used by the set
-
contains
- Returns:
- true, if the set contains
value
-
indexOf
- Returns:
- the position of
element
in the collection, if it's present
-
size
public long size()- Returns:
- the number of elements in the collection
-
nth
- Returns:
- the element at
idx
-
elements
-
isLinear
public boolean isLinear()- 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.
- 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.
- Returns:
- a linear form of this data structure
-