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

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

public class CopyOnWriteSortedCache<T extends java.lang.Comparable<T>>
extends java.lang.Object
implements java.lang.Iterable<T>

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


Constructor Summary
CopyOnWriteSortedCache(java.lang.Iterable<T> elements)
           
 
Method Summary
 T add(T t)
           
 java.util.List<T> asList()
          An unmodifiable List view of the underlying data that does not change.
 java.util.SortedSet<T> asSortedSet()
          An unmodifiable SortedSet view of the underlying data that does not change.
 java.util.Iterator<T> iterator()
           
 void remove(T t)
           
 void replaceAll(java.lang.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(java.lang.Iterable<T> elements)
Method Detail

add

public T add(T t)

remove

public void remove(T t)

replaceAll

public void replaceAll(java.lang.Iterable<T> elements)

asList

public java.util.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 java.util.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 java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T extends java.lang.Comparable<T>>


Copyright © 2002-2010 Atlassian. All Rights Reserved.