Class 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 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()