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 classSortedIntList.Iteratorstatic classSortedIntList.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 voidclear()Clears listEget(int index)Retrieves an element at a given indexEinsert(int index, E value)Inserts an element into the list at the given indexbooleanisEmpty()Returns true if the list is empty.java.util.Iterator<SortedIntList.Node<E>>iterator()Returns an iterator to traverse the list.booleannotEmpty()Returns true if the list has one or more items.intsize()
-
-
-
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.allocateIteratorsis false, the same iterator instance is returned each time this method is called. Use theSortedIntList.Iteratorconstructor for nested or multithreaded iteration.- Specified by:
iteratorin interfacejava.lang.Iterable<E>
-
-