Package com.badlogic.gdx.utils
Class SortedIntList<E>
- java.lang.Object
-
- com.badlogic.gdx.utils.SortedIntList<E>
-
- Type Parameters:
E
-
- All Implemented Interfaces:
java.lang.Iterable<SortedIntList.Node<E>>
public class SortedIntList<E> extends java.lang.Object implements java.lang.Iterable<SortedIntList.Node<E>>
A sorted double linked list which uses ints for indexing
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
SortedIntList.Iterator
static class
SortedIntList.Node<E>
-
Constructor Summary
Constructors Constructor Description SortedIntList()
Creates an ascending list
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears listE
get(int index)
Retrieves an element at a given indexE
insert(int index, E value)
Inserts an element into the list at the given indexboolean
isEmpty()
Returns true if the list is empty.java.util.Iterator<SortedIntList.Node<E>>
iterator()
Returns an iterator to traverse the list.boolean
notEmpty()
Returns true if the list has one or more items.int
size()
-
-
-
Method Detail
-
insert
@Null public E insert(int index, E value)
Inserts an element into the list at the given index- Parameters:
index
- Index of the elementvalue
- Element to insert- Returns:
- Element replaced by newly inserted element, null if nothing was replaced
-
get
public E get(int index)
Retrieves an element at a given index- Parameters:
index
- Index of the element to retrieve- Returns:
- Matching element, null otherwise
-
clear
public void clear()
Clears list
-
size
public int size()
- Returns:
- size of list equal to elements contained in it
-
notEmpty
public boolean notEmpty()
Returns true if the list has one or more items.
-
isEmpty
public boolean isEmpty()
Returns true if the list is empty.
-
iterator
public java.util.Iterator<SortedIntList.Node<E>> iterator()
Returns an iterator to traverse the list.If
Collections.allocateIterators
is false, the same iterator instance is returned each time this method is called. Use theSortedIntList.Iterator
constructor for nested or multithreaded iteration.- Specified by:
iterator
in interfacejava.lang.Iterable<E>
-
-