com.badlogic.gdx.utils
Class SortedIntList<E>

java.lang.Object
  extended by com.badlogic.gdx.utils.SortedIntList<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterable<SortedIntList.Node<E>>

public class SortedIntList<E>
extends Object
implements Iterable<SortedIntList.Node<E>>

A sorted double linked list which uses ints for indexing


Nested Class Summary
static class SortedIntList.Node<E>
           
 
Constructor Summary
SortedIntList()
          Creates an ascending list
 
Method Summary
 void clear()
          Clears list
 E get(int index)
          Retrieves an element at a given index
 E insert(int index, E value)
          Inserts an element into the list at the given index
 Iterator<SortedIntList.Node<E>> iterator()
          Returns an iterator to traverse the list.
Only one iterator can be active per list at any given time.
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedIntList

public SortedIntList()
Creates an ascending list

Method Detail

insert

public E insert(int index,
                E value)
Inserts an element into the list at the given index

Parameters:
index - Index of the element
value - 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

iterator

public Iterator<SortedIntList.Node<E>> iterator()
Returns an iterator to traverse the list.
Only one iterator can be active per list at any given time.

Specified by:
iterator in interface Iterable<SortedIntList.Node<E>>
Returns:
Iterator to traverse list


Copyright © 2013. All Rights Reserved.