public class PriorityList<E> extends AbstractList<E>
Priority is an integer, and the list is sorted in descending order (that is, 100 is before 10 is before 0 is before -40).
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PRIORITY
This is the default priority, which is used if no priority
is defined.
|
modCount
Constructor and Description |
---|
PriorityList() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o)
Adds an object using the default priority to the List.
|
void |
add(E o,
int priority)
Adds an object to its correct place in the list, using the
given priority.
|
E |
get(int index)
Returns the object at index "index".
|
int |
size()
Returns the current size of the list.
|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public static final int DEFAULT_PRIORITY
public PriorityList()
public void add(E o, int priority)
o
- Object to add.priority
- Priority.public boolean add(E o)
add
in interface Collection<E>
add
in interface List<E>
add
in class AbstractList<E>
o
- Object to add.public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in class AbstractCollection<E>
Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.