Class BigList.Block<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- org.magicwerk.brownies.collections.IList<E>
-
- org.magicwerk.brownies.collections.GapList<T>
-
- org.magicwerk.brownies.collections.BigList.Block<T>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.List<T>
,java.util.RandomAccess
,ICollection<T>
,IListable<T>
static class BigList.Block<T> extends GapList<T>
A block stores in maximum blockSize number of elements. The first block in a BigList will grow until reaches this limit, all other blocks are directly allocated with a capacity of blockSize. A block maintains a reference count which allows a block to be shared among different BigList instances with a copy-on-write approach.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.magicwerk.brownies.collections.GapList
GapList.ReadOnlyList<E>
-
Nested classes/interfaces inherited from class org.magicwerk.brownies.collections.IList
IList.IListableFromArray<E>, IList.IListableFromCollection<E>, IList.IListableFromList<E>, IList.IListableFromMult<E>, IList.Iter, IList.ListIter
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicInteger
refCount
-
Fields inherited from class org.magicwerk.brownies.collections.GapList
DEFAULT_CAPACITY
-
-
Constructor Summary
Constructors Constructor Description Block()
Block(int capacity)
Block(BigList.Block<T> that)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isShared()
BigList.Block<T>
ref()
Increment reference count as block is used by one BigList instance more.void
unref()
Decrement reference count as block is no longer used by one BigList instance.-
Methods inherited from class org.magicwerk.brownies.collections.GapList
add, add, binarySearch, calculateNewCapacity, capacity, clone, copy, create, create, create, crop, doAdd, doAssign, doClear, doClone, doCreate, doEnsureCapacity, doGet, doGetAll, doRemove, doRemoveAll, doRemoveAllFast, doReSet, doSet, EMPTY, ensureNormalized, get, getAll, getAll, getDefaultElem, immutable, immutable, immutableList, init, init, init, init, isNormalized, isReadOnly, map, prepareAddBuffer, releaseAddBuffer, remove, size, sort, trimToSize, unmodifiableList
-
Methods inherited from class org.magicwerk.brownies.collections.IList
addAll, addAll, addAll, addAll, addArray, addArray, addArray, addArray, addFirst, addIfAbsent, addLast, addMult, addMult, asDeque, asIListable, binarySearch, checkIndex, checkIndexAdd, checkLength, checkLengths, checkNonNull, checkRange, clear, contains, containsAll, containsAny, containsIf, copy, count, countIf, descendingIterator, doAddAll, doCreateArray, doIndexOf, doIndexOfIf, doInitAll, doLastIndexOf, doLastIndexOfIf, doModify, doPutAll, doReplace, doRotate, doTransfer, doTransferSwap, drag, element, ensureCapacity, equals, equalsElem, extract, extractIf, fill, filter, filterMap, flatMap, getDistinct, getFirst, getFirstOrNull, getIf, getLast, getLastOrNull, getSingle, getSingleOrNull, hashCode, hashCodeElem, indexOf, indexOf, indexOfIf, indexOfIf, initAll, initAll, initArray, initMult, isEmpty, iterator, lastIndexOf, lastIndexOf, lastIndexOfIf, lastIndexOfIf, listIterator, listIterator, mapFilter, move, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, put, putAll, putAll, putArray, putMult, remove, remove, remove, removeAll, removeAll, removeAll, removeFirst, removeFirstOccurrence, removeIf, removeLast, removeLastOccurrence, replace, replaceAll, replaceAll, replaceArray, replaceMult, resize, retain, retainAll, retainAll, retainIf, reverse, reverse, rotate, rotate, set, setAll, setAll, setArray, setArray, setMult, sort, swap, toArray, toArray, toArray, toArray, toArray, toArray, toArray, toString, transferCopy, transferMove, transferRemove, transferSwap, transform, transformedList
-
-
-
-
Constructor Detail
-
Block
public Block()
-
Block
public Block(int capacity)
-
Block
public Block(BigList.Block<T> that)
-
-
Method Detail
-
isShared
public boolean isShared()
- Returns:
- true if block is shared by several BigList instances
-
ref
public BigList.Block<T> ref()
Increment reference count as block is used by one BigList instance more.
-
unref
public void unref()
Decrement reference count as block is no longer used by one BigList instance.
-
-