com.ideanest.util
Class RingArrayList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--com.ideanest.util.RingArrayList
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class RingArrayList
extends java.util.AbstractList
implements java.lang.Cloneable, java.io.Serializable

A circular array list that expands automatically when needed.

See Also:
Serialized Form

Constructor Summary
RingArrayList()
           
RingArrayList(java.util.Collection c)
           
RingArrayList(int capacity)
           
 
Method Summary
 void add(int index, java.lang.Object o)
           
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 boolean addAll(int index, java.util.Collection c)
           
 void clear()
           
 java.lang.Object clone()
          Returns a shallow copy of this WraparoundArrayList instance.
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 void ensureCapacity(int minCapacity)
           
 java.lang.Object get(int index)
           
 int indexOf(java.lang.Object o)
           
 boolean isEmpty()
           
 int lastIndexOf(java.lang.Object o)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
           
 java.lang.Object set(int index, java.lang.Object o)
           
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 void trimToSize()
           
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
removeAll, retainAll
 

Constructor Detail

RingArrayList

public RingArrayList()

RingArrayList

public RingArrayList(int capacity)

RingArrayList

public RingArrayList(java.util.Collection c)
Method Detail

add

public void add(int index,
                java.lang.Object o)
Specified by:
add in interface java.util.List
Overrides:
add in class java.util.AbstractList

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.List
Overrides:
add in class java.util.AbstractList

addAll

public boolean addAll(int index,
                      java.util.Collection c)
Specified by:
addAll in interface java.util.List
Overrides:
addAll in class java.util.AbstractList

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.List
Overrides:
addAll in class java.util.AbstractCollection

clear

public void clear()
Specified by:
clear in interface java.util.List
Overrides:
clear in class java.util.AbstractList

clone

public java.lang.Object clone()
Returns a shallow copy of this WraparoundArrayList instance. (The elements themselves are not copied.)

Overrides:
clone in class java.lang.Object
Returns:
a clone of this WraparoundArrayList instance.

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.List
Overrides:
contains in class java.util.AbstractCollection

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.List
Overrides:
containsAll in class java.util.AbstractCollection

ensureCapacity

public void ensureCapacity(int minCapacity)

get

public java.lang.Object get(int index)
Specified by:
get in interface java.util.List
Specified by:
get in class java.util.AbstractList

indexOf

public int indexOf(java.lang.Object o)
Specified by:
indexOf in interface java.util.List
Overrides:
indexOf in class java.util.AbstractList

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.List
Overrides:
isEmpty in class java.util.AbstractCollection

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Specified by:
lastIndexOf in interface java.util.List
Overrides:
lastIndexOf in class java.util.AbstractList

remove

public java.lang.Object remove(int index)
Specified by:
remove in interface java.util.List
Overrides:
remove in class java.util.AbstractList

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.List
Overrides:
remove in class java.util.AbstractCollection

set

public java.lang.Object set(int index,
                            java.lang.Object o)
Specified by:
set in interface java.util.List
Overrides:
set in class java.util.AbstractList

size

public int size()
Specified by:
size in interface java.util.List
Specified by:
size in class java.util.AbstractCollection

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.List
Overrides:
toArray in class java.util.AbstractCollection

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.List
Overrides:
toArray in class java.util.AbstractCollection

trimToSize

public void trimToSize()