com.caucho.util
Class ConcurrentArrayList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by com.caucho.util.ConcurrentArrayList<E>
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>

public class ConcurrentArrayList<E>
extends java.util.AbstractCollection<E>

A Concurrent array similar to the JDK's CopyOnWriteArrayList but saves a fixed array to avoid extra allocations.


Nested Class Summary
static class ConcurrentArrayList.ArrayIterator<E>
           
static interface ConcurrentArrayList.Match<E,K>
           
 
Constructor Summary
ConcurrentArrayList(java.lang.Class<E> type)
           
 
Method Summary
 boolean add(E value)
           
 E addIfAbsent(E value)
           
<K> E
addIfAbsent(E value, ConcurrentArrayList.Match<E,K> match, K key)
           
static java.lang.Class<?> calculateType(java.lang.Class<?> cl)
           
static java.lang.Class<?> calculateType(java.lang.Class<?> topClass, java.lang.Class<?> cl)
           
 boolean contains(java.lang.Object testValue)
           
<K> E
find(K key, ConcurrentArrayList.Match<E,K> match)
           
 E get(int index)
           
<K> int
indexOf(K key, ConcurrentArrayList.Match<E,K> match)
           
 java.util.Iterator<E> iterator()
           
 E remove(int index)
           
<K> E
remove(K key, ConcurrentArrayList.Match<E,K> match)
           
 boolean remove(java.lang.Object value)
           
 E set(int index, E value)
           
 int size()
           
 E[] toArray()
           
 
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, removeAll, retainAll, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

ConcurrentArrayList

public ConcurrentArrayList(java.lang.Class<E> type)
Method Detail

size

public int size()
Specified by:
size in interface java.util.Collection<E>
Specified by:
size in class java.util.AbstractCollection<E>

get

public E get(int index)

contains

public boolean contains(java.lang.Object testValue)
Specified by:
contains in interface java.util.Collection<E>
Overrides:
contains in class java.util.AbstractCollection<E>

find

public <K> E find(K key,
                  ConcurrentArrayList.Match<E,K> match)

indexOf

public <K> int indexOf(K key,
                       ConcurrentArrayList.Match<E,K> match)

add

public boolean add(E value)
Specified by:
add in interface java.util.Collection<E>
Overrides:
add in class java.util.AbstractCollection<E>

addIfAbsent

public E addIfAbsent(E value)

addIfAbsent

public <K> E addIfAbsent(E value,
                         ConcurrentArrayList.Match<E,K> match,
                         K key)

set

public E set(int index,
             E value)

remove

public boolean remove(java.lang.Object value)
Specified by:
remove in interface java.util.Collection<E>
Overrides:
remove in class java.util.AbstractCollection<E>

remove

public E remove(int index)

remove

public <K> E remove(K key,
                    ConcurrentArrayList.Match<E,K> match)

iterator

public java.util.Iterator<E> iterator()
Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>
Specified by:
iterator in class java.util.AbstractCollection<E>

toArray

public E[] toArray()
Specified by:
toArray in interface java.util.Collection<E>
Overrides:
toArray in class java.util.AbstractCollection<E>

calculateType

public static java.lang.Class<?> calculateType(java.lang.Class<?> cl)

calculateType

public static java.lang.Class<?> calculateType(java.lang.Class<?> topClass,
                                               java.lang.Class<?> cl)