Class ByteGapList.ReadOnlyList
java.lang.Object
org.magicwerk.brownies.collections.primitive.IByteList
org.magicwerk.brownies.collections.primitive.ByteGapList
org.magicwerk.brownies.collections.primitive.ByteGapList.ReadOnlyList
- All Implemented Interfaces:
Serializable,Cloneable,IByteListable
- Enclosing class:
ByteGapList
A read-only version of
ByteGapList.
It is used to implement both unmodifiable and immutable lists.
Note that the client cannot change the list, but the content may change if the underlying list is changed.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.magicwerk.brownies.collections.primitive.ByteGapList
ByteGapList.ReadOnlyListNested classes/interfaces inherited from class org.magicwerk.brownies.collections.primitive.IByteList
IByteList.IByteListableFromArray, IByteList.IByteListableFromCollection, IByteList.IByteListableFromList, IByteList.IByteListableFromMult -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longUID for serializationFields inherited from class org.magicwerk.brownies.collections.primitive.ByteGapList
DEFAULT_CAPACITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedReadOnlyList(ByteGapList that) Private constructor used internally. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleandoAdd(int index, byte elem) Helper method for adding an element to the list.protected voiddoClear()protected voiddoModify()This method is called internally before elements are allocated or freed.protected bytedoRemove(int index) Helper method to remove an element.protected voiddoRemoveAll(int index, int len) Remove specified range of elements from list.protected bytedoReSet(int index, byte elem) Sets an element at specified position.protected bytedoSet(int index, byte elem) Helper method for setting an element in the list.private voiderror()Throw exception if an attempt is made to change an immutable list.Methods inherited from class org.magicwerk.brownies.collections.primitive.ByteGapList
add, add, binarySearch, calculateNewCapacity, capacity, clone, copy, create, create, create, crop, doAssign, doClone, doCreate, doEnsureCapacity, doGet, doGetAll, doRemoveAllFast, EMPTY, ensureNormalized, get, getAll, getAll, getDefaultElem, immutable, immutable, immutableList, init, init, init, init, isNormalized, isReadOnly, map, prepareAddBuffer, releaseAddBuffer, remove, size, sort, trimToSize, unmodifiableListMethods inherited from class org.magicwerk.brownies.collections.primitive.IByteList
addAll, addAll, addAll, addAll, addArray, addArray, addArray, addArray, addFirst, addIfAbsent, addLast, addMult, addMult, asIByteListable, binarySearch, checkIndex, checkIndexAdd, checkLength, checkLengths, checkNonNull, checkRange, clear, contains, containsAll, containsAny, containsIf, copy, count, countIf, doAddAll, doCreateArray, doIndexOf, doIndexOfIf, doInitAll, doLastIndexOf, doLastIndexOfIf, 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, lastIndexOf, lastIndexOf, lastIndexOfIf, lastIndexOfIf, mapFilter, move, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, put, putAll, putAll, putArray, putMult, remove, remove, removeAll, removeAll, removeAll, removeElem, 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
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUID for serialization- See Also:
-
-
Constructor Details
-
ReadOnlyList
Private constructor used internally.- Parameters:
that- list to create an immutable view of
-
-
Method Details
-
doAdd
protected boolean doAdd(int index, byte elem) Description copied from class:IByteListHelper method for adding an element to the list. This is the only method which really adds an element. Override if you need to validity checks before adding.- Overrides:
doAddin classByteGapList- Parameters:
index- index where element should be added (-1 means it is up to the implementation to choose the index)elem- element to add- Returns:
- true if element has been added, false otherwise
-
doSet
protected byte doSet(int index, byte elem) Description copied from class:IByteListHelper method for setting an element in the list. This is the only method which really sets an element. Override if you need to validity checks before setting.- Overrides:
doSetin classByteGapList- Parameters:
index- index where element will be placedelem- element to set- Returns:
- old element which was at the position
-
doReSet
protected byte doReSet(int index, byte elem) Description copied from class:IByteListSets an element at specified position. This method is used internally if existing elements will be moved etc. Override if you need to validity checks.- Overrides:
doReSetin classByteGapList- Parameters:
index- index where element will be placedelem- element to set- Returns:
- old element which was at the position
-
doRemove
protected byte doRemove(int index) Description copied from class:IByteListHelper method to remove an element. This is the only method which really removes an element. Override if you need to validity checks before removing.- Overrides:
doRemovein classByteGapList- Parameters:
index- index of element to remove- Returns:
- removed element
-
doRemoveAll
protected void doRemoveAll(int index, int len) Description copied from class:IByteListRemove specified range of elements from list.- Overrides:
doRemoveAllin classByteGapList- Parameters:
index- index of first element to removelen- number of elements to remove
-
doClear
protected void doClear()- Overrides:
doClearin classByteGapList
-
doModify
protected void doModify()Description copied from class:IByteListThis method is called internally before elements are allocated or freed. Override if you need to validity checks. -
error
private void error()Throw exception if an attempt is made to change an immutable list.
-