ch.bind.philib.util
Class CowSet<E>

java.lang.Object
  extended by ch.bind.philib.util.CowSet<E>

public final class CowSet<E>
extends Object

A simple implementation of a copy-on-write set.
There are two modification methods: add(Object) and remove(Object)
and two read methods: getView() and isEmpty()
Every modification through the add(Object) or remove(Object) methods and a return value of true will update the view.
The view is shared among all clients and must therefore not be modified!
The modification methods are not optimized for speed since the intent of this cow-list is to guarantee fast reads.

Author:
Philipp Meinen

Constructor Summary
CowSet(Class<E> clazz)
           
 
Method Summary
 boolean add(E e)
           
 E[] getView()
           
 boolean isEmpty()
           
 boolean remove(E e)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CowSet

public CowSet(Class<E> clazz)
Method Detail

add

public boolean add(E e)

remove

public boolean remove(E e)

getView

public E[] getView()
Returns:
the current content of the copy-on-write set ; do not modify!

isEmpty

public boolean isEmpty()

size

public int size()


Copyright © 2013. All Rights Reserved.