|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.esper.collection.ArrayBackedCollection<T>
public class ArrayBackedCollection<T>
A fast collection backed by an array with severe limitations. Allows direct access to the backing array - this must be used with care as old elements could be in the array and the array is only valid until the number of elements indicated by size.
Implements only the add, size and clear methods of the collection interface.
When running out of space for the underlying array, allocates a new array of double the size of the current array.
Not synchronized and not thread-safe.
Constructor Summary | |
---|---|
ArrayBackedCollection(int currentSize)
Ctor. |
Method Summary | |
---|---|
boolean |
add(Object object)
|
boolean |
addAll(Collection c)
|
void |
clear()
|
boolean |
contains(Object o)
|
boolean |
containsAll(Collection c)
|
Object[] |
getArray()
Returns the backing object array, valid until the current size. |
boolean |
isEmpty()
|
Iterator |
iterator()
|
boolean |
remove(Object o)
|
boolean |
removeAll(Collection c)
|
boolean |
retainAll(Collection c)
|
int |
size()
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Constructor Detail |
---|
public ArrayBackedCollection(int currentSize)
currentSize
- is the initial size of the backing array.Method Detail |
---|
public boolean add(Object object)
add
in interface Collection<T>
public void clear()
clear
in interface Collection<T>
public int size()
size
in interface Collection<T>
public Object[] getArray()
Applications must ensure to not read past current size as old elements can be encountered.
public boolean isEmpty()
isEmpty
in interface Collection<T>
public boolean contains(Object o)
contains
in interface Collection<T>
public Iterator iterator()
iterator
in interface Iterable<T>
iterator
in interface Collection<T>
public Object[] toArray()
toArray
in interface Collection<T>
public Object[] toArray(Object[] a)
toArray
in interface Collection<T>
public boolean remove(Object o)
remove
in interface Collection<T>
public boolean addAll(Collection c)
addAll
in interface Collection<T>
public boolean retainAll(Collection c)
retainAll
in interface Collection<T>
public boolean removeAll(Collection c)
removeAll
in interface Collection<T>
public boolean containsAll(Collection c)
containsAll
in interface Collection<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |