org.jactr.core.utils.collections
Class CachedCollection<I>

java.lang.Object
  extended by org.jactr.core.utils.collections.CachedCollection<I>
Type Parameters:
I -
All Implemented Interfaces:
java.lang.Iterable<I>, java.util.Collection<I>

public class CachedCollection<I>
extends java.lang.Object
implements java.util.Collection<I>

a collection that permits asynchronous changes to its contents without affecting calls to getCachedCopy() Even though it is synchronized, care must be taken to synchronize the collection while iterating over it

Author:
developer

Constructor Summary
CachedCollection(java.util.Collection<I> backing)
           
 
Method Summary
 boolean add(I arg0)
           
 boolean addAll(java.util.Collection<? extends I> arg0)
           
 void clear()
           
 boolean contains(java.lang.Object arg0)
           
 boolean containsAll(java.util.Collection<?> arg0)
           
 java.util.Collection<I> getBackingValues()
           
 java.util.Collection<I> getCachedValues()
           
 boolean isEmpty()
           
 java.util.Iterator<I> iterator()
           
 boolean remove(java.lang.Object arg0)
           
 boolean removeAll(java.util.Collection<?> arg0)
           
 boolean retainAll(java.util.Collection<?> arg0)
           
 int size()
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] arg0)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

CachedCollection

public CachedCollection(java.util.Collection<I> backing)
Method Detail

add

public boolean add(I arg0)
Specified by:
add in interface java.util.Collection<I>

addAll

public boolean addAll(java.util.Collection<? extends I> arg0)
Specified by:
addAll in interface java.util.Collection<I>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<I>

contains

public boolean contains(java.lang.Object arg0)
Specified by:
contains in interface java.util.Collection<I>

containsAll

public boolean containsAll(java.util.Collection<?> arg0)
Specified by:
containsAll in interface java.util.Collection<I>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<I>

iterator

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

remove

public boolean remove(java.lang.Object arg0)
Specified by:
remove in interface java.util.Collection<I>

removeAll

public boolean removeAll(java.util.Collection<?> arg0)
Specified by:
removeAll in interface java.util.Collection<I>

retainAll

public boolean retainAll(java.util.Collection<?> arg0)
Specified by:
retainAll in interface java.util.Collection<I>

size

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

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<I>

toArray

public <T> T[] toArray(T[] arg0)
Specified by:
toArray in interface java.util.Collection<I>

getBackingValues

public java.util.Collection<I> getBackingValues()

getCachedValues

public java.util.Collection<I> getCachedValues()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object