com.atlassian.jira.util.collect
Class CopyOnWriteSortedCache<T extends Comparable<T>>

java.lang.Object
  extended by com.atlassian.jira.util.collect.CopyOnWriteSortedCache<T>
Type Parameters:
T - the element type.
All Implemented Interfaces:
Iterable<T>

public class CopyOnWriteSortedCache<T extends Comparable<T>>
extends Object
implements Iterable<T>

Simple copy-on-write ordered cache with Set semantics. This implementation supports add/remove and replace all of elements.


Constructor Summary
CopyOnWriteSortedCache(Iterable<T> elements)
           
 
Method Summary
 T add(T t)
           
 List<T> asList()
          An unmodifiable List view of the underlying data that does not change.
 SortedSet<T> asSortedSet()
          An unmodifiable SortedSet view of the underlying data that does not change.
 Iterator<T> iterator()
           
 void remove(T t)
           
 void replaceAll(Iterable<T> elements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyOnWriteSortedCache

public CopyOnWriteSortedCache(Iterable<T> elements)
Method Detail

add

public T add(T t)

remove

public void remove(T t)

replaceAll

public void replaceAll(Iterable<T> elements)

asList

public List<T> asList()
An unmodifiable List view of the underlying data that does not change.

Returns:
a List containing all the elements as at the time the call was made.

asSortedSet

public SortedSet<T> asSortedSet()
An unmodifiable SortedSet view of the underlying data that does not change.

Returns:
a SortedSet containing all the elements as at the time the call was made.

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T extends Comparable<T>>


Copyright © 2002-2010 Atlassian. All Rights Reserved.