APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.utils

public Class SortedIntList<E>

extends Object
implements Iterable<SortedIntList.Node<E>>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable

A sorted double linked list which uses ints for indexing

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
public static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv SortedIntList.Node<E>
private transient SortedIntList<E>.Iterator
private SortedIntList.NodePool<E>
pack-priv int

Constructor Summary

AccessConstructor and Description
public
SortedIntList()

Creates an ascending list

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clears list

public E

Returns:

Matching element, null otherwise
get
(int
Index of the element to retrieve
index
)

Retrieves an element at a given index

public E

Returns:

Element replaced by newly inserted element, null if nothing was replaced
insert
(int
Index of the element
index
,
E
Element to insert
value
)

Inserts an element into the list at the given index

public boolean
isEmpty()

Returns true if the list is empty.

public Iterator<SortedIntList.Node<E>>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator to traverse the list.

public boolean
notEmpty()

Returns true if the list has one or more items.

public int
size()

Returns: size of list equal to elements contained in it

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

firstback to summary
pack-priv SortedIntList.Node<E> first
iteratorback to summary
private transient SortedIntList<E>.Iterator iterator
nodePoolback to summary
private SortedIntList.NodePool<E> nodePool
sizeback to summary
pack-priv int size

Constructor Detail

SortedIntListback to summary
public SortedIntList()

Creates an ascending list

Method Detail

clearback to summary
public void clear()

Clears list

getback to summary
public E get(int index)

Retrieves an element at a given index

Parameters
index:int

Index of the element to retrieve

Returns:E

Matching element, null otherwise

insertback to summary
public E insert(int index, E value)

Inserts an element into the list at the given index

Parameters
index:int

Index of the element

value:E

Element to insert

Returns:E

Element replaced by newly inserted element, null if nothing was replaced

Annotations
@Null
isEmptyback to summary
public boolean isEmpty()

Returns true if the list is empty.

iteratorback to summary
public Iterator<SortedIntList.Node<E>> iterator()

Implements java.lang.Iterable.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 the Iterator constructor for nested or multithreaded iteration.

notEmptyback to summary
public boolean notEmpty()

Returns true if the list has one or more items.

sizeback to summary
public int size()
Returns:int

size of list equal to elements contained in it

com.badlogic.gdx.utils back to summary

public Class SortedIntList.Iterator

extends Object
implements Iterator<SortedIntList.Node<E>>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private SortedIntList.Node<E>
private SortedIntList.Node<E>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public SortedIntList.Node<E>
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

public SortedIntList<E>.Iterator
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

positionback to summary
private SortedIntList.Node<E> position
previousPositionback to summary
private SortedIntList.Node<E> previousPosition

Constructor Detail

Iteratorback to summary
public Iterator()

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Annotations
@Override
nextback to summary
public SortedIntList.Node<E> next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
resetback to summary
public SortedIntList<E>.Iterator reset()
com.badlogic.gdx.utils back to summary

public Class SortedIntList.Node<E>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public int
index

Index value in list

protected SortedIntList.Node<E>
n

Node next to this

protected SortedIntList.Node<E>
p

Node previous to this

public E
value

Value held

Constructor Summary

AccessConstructor and Description
public
Node()

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
public int index

Index value in list

nback to summary
protected SortedIntList.Node<E> n

Node next to this

pback to summary
protected SortedIntList.Node<E> p

Node previous to this

valueback to summary
public E value

Value held

Constructor Detail

Nodeback to summary
public Node()
com.badlogic.gdx.utils back to summary

pack-priv Class SortedIntList.NodePool<E>

extends Pool<SortedIntList.Node<E>>
Class Inheritance

Field Summary

Inherited from com.badlogic.gdx.utils.Pool:
maxpeak

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected SortedIntList.Node<E>
public SortedIntList.Node<E>
obtain(SortedIntList.Node<E> p, SortedIntList.Node<E> n, E value, int index)

Inherited from com.badlogic.gdx.utils.Pool:
cleardiscardfillfreefreeAllgetFreeobtainreset

Constructor Detail

NodePoolback to summary
pack-priv NodePool()

Method Detail

newObjectback to summary
protected SortedIntList.Node<E> newObject()

Implements abstract com.badlogic.gdx.utils.Pool.newObject.

Annotations
@Override
obtainback to summary
public SortedIntList.Node<E> obtain(SortedIntList.Node<E> p, SortedIntList.Node<E> n, E value, int index)