Class GapList.ReadOnlyList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- org.magicwerk.brownies.collections.IList<E>
-
- org.magicwerk.brownies.collections.GapList<E>
-
- org.magicwerk.brownies.collections.GapList.ReadOnlyList<E>
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.List<E>,java.util.RandomAccess,ICollection<E>,IListable<E>
protected static class GapList.ReadOnlyList<E> extends GapList<E>
A read-only version ofGapList. 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:
- Serialized Form
-
-
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 static longserialVersionUIDUID for serialization-
Fields inherited from class org.magicwerk.brownies.collections.GapList
DEFAULT_CAPACITY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedReadOnlyList(GapList<E> that)Private constructor used internally.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleandoAdd(int index, E 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 EdoRemove(int index)Helper method to remove an element.protected voiddoRemoveAll(int index, int len)Remove specified range of elements from list.protected EdoReSet(int index, E elem)Sets an element at specified position.protected EdoSet(int index, E 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.GapList
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, 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, 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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
UID for serialization- See Also:
- Constant Field Values
-
-
Method Detail
-
doAdd
protected boolean doAdd(int index, E elem)Description copied from class:IListHelper 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.
-
doSet
protected E doSet(int index, E elem)
Description copied from class:IListHelper 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.
-
doReSet
protected E doReSet(int index, E elem)
Description copied from class:IListSets an element at specified position. This method is used internally if existing elements will be moved etc. Override if you need to validity checks.
-
doRemove
protected E doRemove(int index)
Description copied from class:IListHelper method to remove an element. This is the only method which really removes an element. Override if you need to validity checks before removing.
-
doRemoveAll
protected void doRemoveAll(int index, int len)Description copied from class:IListRemove specified range of elements from list.- Overrides:
doRemoveAllin classGapList<E>- Parameters:
index- index of first element to removelen- number of elements to remove
-
doModify
protected void doModify()
Description copied from class:IListThis 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.
-
-