Package net.automatalib.common.util.nid
Class DynamicList<T extends MutableNumericID>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<T>
-
- net.automatalib.common.util.nid.DynamicList<T>
-
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,List<T>
,ArrayWritable<T>
- Direct Known Subclasses:
FastAlphabet
public class DynamicList<T extends MutableNumericID> extends AbstractList<T> implements ArrayWritable<T>
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description DynamicList()
DynamicList(List<? extends T> initial)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T elem)
void
clear()
T
get(int index)
boolean
isEmpty()
Iterator<T>
iterator()
T
remove(int index, IDChangeNotifier<T> tracker)
boolean
remove(@Nullable Object elem)
boolean
remove(@Nullable Object elem, @Nullable IDChangeNotifier<T> tracker)
@Nullable T
safeGet(int index)
int
size()
The size of this container.void
swap(int a, int b)
void
writeToArray(int offset, @Nullable Object[] array, int tgtOfs, int num)
Writes the contents of this container to an array.-
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
size
public int size()
Description copied from interface:ArrayWritable
The size of this container.- Specified by:
size
in interfaceArrayWritable<T extends MutableNumericID>
- Specified by:
size
in interfaceCollection<T extends MutableNumericID>
- Specified by:
size
in interfaceList<T extends MutableNumericID>
- Specified by:
size
in classAbstractCollection<T extends MutableNumericID>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<T extends MutableNumericID>
- Specified by:
isEmpty
in interfaceList<T extends MutableNumericID>
- Overrides:
isEmpty
in classAbstractCollection<T extends MutableNumericID>
-
remove
public boolean remove(@Nullable Object elem)
- Specified by:
remove
in interfaceCollection<T extends MutableNumericID>
- Specified by:
remove
in interfaceList<T extends MutableNumericID>
- Overrides:
remove
in classAbstractCollection<T extends MutableNumericID>
-
remove
public boolean remove(@Nullable Object elem, @Nullable IDChangeNotifier<T> tracker)
-
remove
public T remove(int index, IDChangeNotifier<T> tracker)
-
add
public boolean add(T elem)
- Specified by:
add
in interfaceCollection<T extends MutableNumericID>
- Specified by:
add
in interfaceList<T extends MutableNumericID>
- Overrides:
add
in classAbstractList<T extends MutableNumericID>
-
get
public T get(int index)
- Specified by:
get
in interfaceList<T extends MutableNumericID>
- Specified by:
get
in classAbstractList<T extends MutableNumericID>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<T extends MutableNumericID>
- Specified by:
clear
in interfaceList<T extends MutableNumericID>
- Overrides:
clear
in classAbstractList<T extends MutableNumericID>
-
iterator
public Iterator<T> iterator()
- Specified by:
iterator
in interfaceCollection<T extends MutableNumericID>
- Specified by:
iterator
in interfaceIterable<T extends MutableNumericID>
- Specified by:
iterator
in interfaceList<T extends MutableNumericID>
- Overrides:
iterator
in classAbstractList<T extends MutableNumericID>
-
swap
public void swap(int a, int b)
-
writeToArray
public void writeToArray(int offset, @Nullable Object[] array, int tgtOfs, int num)
Description copied from interface:ArrayWritable
Writes the contents of this container to an array. The behavior of calling this method should be equivalent toSystem.arraycopy(this.toArray(), offset, array, tgtOfs, num);
- Specified by:
writeToArray
in interfaceArrayWritable<T extends MutableNumericID>
- Parameters:
offset
- how many elements of this container to skip.array
- the array in which to store the elements.tgtOfs
- the starting offset in the target array.num
- the maximum number of elements to copy.
-
-