Package org.openstreetmap.josm.tools
Class CopyList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
org.openstreetmap.josm.tools.CopyList<E>
- Type Parameters:
E- the type of elements in this list
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,RandomAccess
A List implementation initially based on given array, but never modifying
the array directly. On the first modification, the implementation will
create its own copy of the array, and after that it behaves mostly as
an ArrayList.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanprivate voidvoidclear()private voidensureCapacity(int target) get(int index) iterator()private voidrangeCheck(int index) remove(int index) intsize()Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Field Details
-
array
-
size
-
pristine
-
-
Constructor Details
-
CopyList
Create a List over given array.- Parameters:
array- The initial List content. The array is never modified by theCopyList.
-
CopyList
Create a List over given array and size.- Parameters:
array- The initial List content. The array is never modified by theCopyList.size- number of items
-
-
Method Details
-
get
-
size
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
set
-
add
-
remove
-
add
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceList<E>- Overrides:
addin classAbstractList<E>
-
clear
- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceList<E>- Overrides:
clearin classAbstractList<E>
-
rangeCheck
-
changeCheck
-
ensureCapacity
-
iterator
-