Package edu.wpi.first.wpilibj.util
Class SortedVector<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<E>
-
- edu.wpi.first.wpilibj.util.SortedVector<E>
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,List<E>
,RandomAccess
public class SortedVector<E> extends Vector<E>
A vector that is sorted.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SortedVector.Comparator
Interface used to determine the order to place sorted objects.
-
Field Summary
-
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description SortedVector(SortedVector.Comparator comparator)
Create a new sorted vector and use the given comparator to determine order.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElement(E element)
Adds an element in the Vector, sorted from greatest to least.void
sort()
Sort the vector.-
Methods inherited from class java.util.Vector
add, add, addAll, addAll, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, toString, 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
-
-
-
-
Constructor Detail
-
SortedVector
public SortedVector(SortedVector.Comparator comparator)
Create a new sorted vector and use the given comparator to determine order.- Parameters:
comparator
- The comparator to use to determine what order to place the elements in this vector.
-
-
Method Detail
-
addElement
public void addElement(E element)
Adds an element in the Vector, sorted from greatest to least.- Overrides:
addElement
in classVector<E>
- Parameters:
element
- The element to add to the Vector
-
sort
public void sort()
Sort the vector.
-
-