Package org.leplus.ristretto.util
Class VectorAdapter<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<E>
-
- org.leplus.ristretto.util.VectorAdapter<E>
-
- Type Parameters:
E
- type of the elements in the collection.
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,List<E>
,RandomAccess
- Direct Known Subclasses:
ArrayListVector
public abstract class VectorAdapter<E> extends Vector<E>
This adapter class extendsVector
to make it easier to replaceVector
uses by anotherList
implementation.- Since:
- 1.0.0
- Author:
- Thomas Leplus
- See Also:
ArrayListVector
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
VectorAdapter()
Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(int index, E element)
boolean
add(E o)
boolean
addAll(int index, Collection<? extends E> c)
boolean
addAll(Collection<? extends E> c)
void
addElement(E obj)
int
capacity()
void
clear()
Object
clone()
boolean
contains(Object elem)
boolean
containsAll(Collection<?> c)
void
copyInto(Object[] anArray)
protected abstract List<E>
delegate()
Accessor to the delegate provided by subclass.E
elementAt(int index)
Enumeration<E>
elements()
abstract void
ensureCapacity(int minCapacity)
boolean
equals(Object obj)
E
firstElement()
void
forEach(Consumer<? super E> action)
E
get(int index)
int
hashCode()
int
indexOf(Object elem)
int
indexOf(Object elem, int index)
void
insertElementAt(E obj, int index)
boolean
isEmpty()
Iterator<E>
iterator()
E
lastElement()
int
lastIndexOf(Object elem)
int
lastIndexOf(Object elem, int index)
ListIterator<E>
listIterator()
ListIterator<E>
listIterator(int index)
E
remove(int index)
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
void
removeAllElements()
boolean
removeElement(Object obj)
void
removeElementAt(int index)
boolean
removeIf(Predicate<? super E> filter)
protected void
removeRange(int fromIndex, int toIndex)
void
replaceAll(UnaryOperator<E> operator)
boolean
retainAll(Collection<?> c)
E
set(int index, E element)
void
setElementAt(E obj, int index)
void
setSize(int newSize)
int
size()
void
sort(Comparator<? super E> c)
Spliterator<E>
spliterator()
List<E>
subList(int fromIndex, int toIndex)
Object[]
toArray()
<T> T[]
toArray(T[] a)
String
toString()
abstract void
trimToSize()
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
add
public boolean add(E o)
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceList<E>
- Overrides:
add
in classVector<E>
- See Also:
Vector.add(java.lang.Object)
-
add
public void add(int index, E element)
-
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAll
in interfaceCollection<E>
- Specified by:
addAll
in interfaceList<E>
- Overrides:
addAll
in classVector<E>
- See Also:
Vector.addAll(java.util.Collection)
-
addAll
public boolean addAll(int index, Collection<? extends E> c)
-
addElement
public void addElement(E obj)
- Overrides:
addElement
in classVector<E>
- See Also:
Vector.addElement(java.lang.Object)
-
capacity
public int capacity()
- Overrides:
capacity
in classVector<E>
- See Also:
Vector.capacity()
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceList<E>
- Overrides:
clear
in classVector<E>
- See Also:
Vector.clear()
-
clone
public Object clone()
- Overrides:
clone
in classVector<E>
- See Also:
Vector.clone()
-
contains
public boolean contains(Object elem)
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceList<E>
- Overrides:
contains
in classVector<E>
- See Also:
Vector.contains(java.lang.Object)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceList<E>
- Overrides:
containsAll
in classVector<E>
- See Also:
Vector.containsAll(java.util.Collection)
-
copyInto
public void copyInto(Object[] anArray)
- Overrides:
copyInto
in classVector<E>
- See Also:
Vector.copyInto(java.lang.Object[])
-
delegate
protected abstract List<E> delegate()
Accessor to the delegate provided by subclass.- Returns:
- the delegate.
-
elementAt
public E elementAt(int index)
- Overrides:
elementAt
in classVector<E>
- Returns:
- the component at the specified index
- See Also:
Vector.elementAt(int)
-
elements
public Enumeration<E> elements()
- Overrides:
elements
in classVector<E>
- See Also:
Vector.elements()
-
ensureCapacity
public abstract void ensureCapacity(int minCapacity)
- Overrides:
ensureCapacity
in classVector<E>
- See Also:
Vector.ensureCapacity(int)
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceCollection<E>
- Specified by:
equals
in interfaceList<E>
- Overrides:
equals
in classVector<E>
- See Also:
Vector.equals(java.lang.Object)
-
firstElement
public E firstElement()
- Overrides:
firstElement
in classVector<E>
- See Also:
Vector.firstElement()
-
get
public E get(int index)
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<E>
- Specified by:
hashCode
in interfaceList<E>
- Overrides:
hashCode
in classVector<E>
- See Also:
Vector.hashCode()
-
indexOf
public int indexOf(Object elem)
-
indexOf
public int indexOf(Object elem, int index)
- Overrides:
indexOf
in classVector<E>
- See Also:
Vector.indexOf(java.lang.Object, int)
-
insertElementAt
public void insertElementAt(E obj, int index)
- Overrides:
insertElementAt
in classVector<E>
- See Also:
Vector.insertElementAt(java.lang.Object, int)
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceList<E>
- Overrides:
isEmpty
in classVector<E>
- See Also:
Vector.isEmpty()
-
lastElement
public E lastElement()
- Overrides:
lastElement
in classVector<E>
- See Also:
Vector.lastElement()
-
lastIndexOf
public int lastIndexOf(Object elem)
- Specified by:
lastIndexOf
in interfaceList<E>
- Overrides:
lastIndexOf
in classVector<E>
- See Also:
Vector.lastIndexOf(java.lang.Object)
-
lastIndexOf
public int lastIndexOf(Object elem, int index)
- Overrides:
lastIndexOf
in classVector<E>
- See Also:
Vector.lastIndexOf(java.lang.Object, int)
-
listIterator
public ListIterator<E> listIterator()
- Specified by:
listIterator
in interfaceList<E>
- Overrides:
listIterator
in classVector<E>
- See Also:
Vector.listIterator()
-
listIterator
public ListIterator<E> listIterator(int index)
- Specified by:
listIterator
in interfaceList<E>
- Overrides:
listIterator
in classVector<E>
- See Also:
Vector.listIterator(int)
-
remove
public E remove(int index)
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceList<E>
- Overrides:
remove
in classVector<E>
- See Also:
Vector.remove(java.lang.Object)
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<E>
- Specified by:
removeAll
in interfaceList<E>
- Overrides:
removeAll
in classVector<E>
- See Also:
Vector.removeAll(java.util.Collection)
-
removeAllElements
public void removeAllElements()
- Overrides:
removeAllElements
in classVector<E>
- See Also:
Vector.removeAllElements()
-
removeElement
public boolean removeElement(Object obj)
- Overrides:
removeElement
in classVector<E>
- See Also:
Vector.removeElement(java.lang.Object)
-
removeElementAt
public void removeElementAt(int index)
- Overrides:
removeElementAt
in classVector<E>
- See Also:
Vector.removeElementAt(int)
-
removeRange
protected void removeRange(int fromIndex, int toIndex)
- Overrides:
removeRange
in classVector<E>
- See Also:
Vector.removeRange(int, int)
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<E>
- Specified by:
retainAll
in interfaceList<E>
- Overrides:
retainAll
in classVector<E>
- See Also:
Vector.retainAll(java.util.Collection)
-
setElementAt
public void setElementAt(E obj, int index)
- Overrides:
setElementAt
in classVector<E>
- See Also:
Vector.setElementAt(java.lang.Object, int)
-
setSize
public void setSize(int newSize)
- Overrides:
setSize
in classVector<E>
- See Also:
Vector.setSize(int)
-
size
public int size()
- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceList<E>
- Overrides:
size
in classVector<E>
- See Also:
Vector.size()
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceList<E>
- Overrides:
toArray
in classVector<E>
- See Also:
Vector.toArray()
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceList<E>
- Overrides:
toArray
in classVector<E>
- See Also:
Vector.toArray(java.lang.Object[])
-
toString
public String toString()
- Overrides:
toString
in classVector<E>
- See Also:
Vector.toString()
-
trimToSize
public abstract void trimToSize()
- Overrides:
trimToSize
in classVector<E>
- See Also:
Vector.trimToSize()
-
removeIf
public boolean removeIf(Predicate<? super E> filter)
- Specified by:
removeIf
in interfaceCollection<E>
- Overrides:
removeIf
in classVector<E>
- See Also:
Vector.removeIf(java.util.function.Predicate)
-
replaceAll
public void replaceAll(UnaryOperator<E> operator)
- Specified by:
replaceAll
in interfaceList<E>
- Overrides:
replaceAll
in classVector<E>
- See Also:
Vector.replaceAll(java.util.function.UnaryOperator)
-
sort
public void sort(Comparator<? super E> c)
-
spliterator
public Spliterator<E> spliterator()
- Specified by:
spliterator
in interfaceCollection<E>
- Specified by:
spliterator
in interfaceIterable<E>
- Specified by:
spliterator
in interfaceList<E>
- Overrides:
spliterator
in classVector<E>
- See Also:
Vector.spliterator()
-
-