Package org.ujmp.core.collections.list
Class ArrayIndexList<M>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<M>
-
- org.ujmp.core.collections.list.ArrayIndexList<M>
-
- Type Parameters:
M
- Type of the elements in the list
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<M>
,java.util.Collection<M>
,java.util.List<M>
,java.util.RandomAccess
- Direct Known Subclasses:
Dictionary
public class ArrayIndexList<M> extends java.util.ArrayList<M>
ArrayIndexList is like an ArrayList, but keeps track of the indices where objects have been added. This improves the speed of indexOf() and contains()- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<M,java.lang.Integer>
indexMap
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description ArrayIndexList()
ArrayIndexList(java.util.Collection<? extends M> c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, M element)
boolean
add(M e)
boolean
addAll(int index, java.util.Collection<? extends M> c)
boolean
addAll(java.util.Collection<? extends M> c)
void
clear()
boolean
contains(java.lang.Object o)
int
indexOf(java.lang.Object o)
int
lastIndexOf(java.lang.Object o)
M
remove(int index)
boolean
remove(java.lang.Object o)
M
set(int index, M element)
-
Methods inherited from class java.util.ArrayList
clone, ensureCapacity, forEach, get, isEmpty, iterator, listIterator, listIterator, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
indexMap
private final java.util.Map<M,java.lang.Integer> indexMap
-
-
Constructor Detail
-
ArrayIndexList
public ArrayIndexList()
-
ArrayIndexList
public ArrayIndexList(java.util.Collection<? extends M> c)
-
-
Method Detail
-
add
public void add(int index, M element)
-
add
public boolean add(M e)
-
addAll
public boolean addAll(java.util.Collection<? extends M> c)
-
addAll
public boolean addAll(int index, java.util.Collection<? extends M> c)
-
clear
public void clear()
-
contains
public boolean contains(java.lang.Object o)
-
indexOf
public int indexOf(java.lang.Object o)
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
-
remove
public M remove(int index)
-
remove
public boolean remove(java.lang.Object o)
-
-