public class DiffList<V> extends IList.Mixin<V> implements IDiffList<V>
IDiffList.Durable<V>, IDiffList.Slice
IList.Mixin<V>
hash
Modifier and Type | Method and Description |
---|---|
IList<V> |
addFirst(V value) |
IList<V> |
addLast(V value) |
DiffList<V> |
clone() |
DiffList<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.
|
boolean |
isLinear() |
DiffList<V> |
linear()
This returns a data structure which is linear, or temporarily mutable.
|
IList<V> |
prefix() |
IDiffList<V> |
rebase(IList<V> newUnderlying)
Returns a new diff, which is rebased atop the new underlying collection.
|
IList<V> |
removeFirst() |
IList<V> |
removeLast() |
IList<V> |
set(long idx,
V value) |
IDiffList.Slice |
slice() |
IList<V> |
slice(long start,
long end) |
IList<V> |
suffix() |
IList<V> |
underlying()
The underlying collection
|
equals, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
diff, equals, first, iterator, last, save, split, spliterator, stream, toArray, toArray, toList, update
nth
public IList<V> underlying()
IDiff
underlying
in interface IDiff<IList<V>>
underlying
in interface IDiffList<V>
public IDiffList.Slice slice()
public IDiffList<V> rebase(IList<V> newUnderlying)
IDiff
a.rebase(b).rebase(c)
is not necessarily equivalent to a.rebase(c)
.public IList<V> removeLast()
removeLast
in interface IList<V>
public IList<V> removeFirst()
removeFirst
in interface IList<V>
public IList<V> set(long idx, V value)
set
in interface IList<V>
idx
overwritten with value
. If idx
is equal to
ICollection.size()
, the value is appended.public boolean isLinear()
public DiffList<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 DiffList<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.