com.atlassian.bamboo.concurrent
Class BoundedSet<E>

java.lang.Object
  extended by com.google.common.collect.ForwardingObject
      extended by com.google.common.collect.ForwardingCollection<E>
          extended by com.google.common.collect.ForwardingSet<E>
              extended by com.atlassian.bamboo.concurrent.BoundedSet<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public class BoundedSet<E>
extends com.google.common.collect.ForwardingSet<E>

A bounded set. Set additions are blocked if set capacity is exceeded.


Constructor Summary
BoundedSet(int maximumSize)
          Creates a HashSet-backed bounded set.
BoundedSet(Set<E> delegate, int maximumSize)
           
 
Method Summary
 boolean add(E e)
           
 boolean addAll(Collection<? extends E> c)
           
 void clear()
           
protected  Set<E> delegate()
           
 Iterator<E> iterator()
          The returned iterator does not support removal.
 E poll()
          See Queue.poll()
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 
Methods inherited from class com.google.common.collect.ForwardingSet
equals, hashCode, standardEquals, standardHashCode
 
Methods inherited from class com.google.common.collect.ForwardingCollection
contains, containsAll, isEmpty, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRemoveAll, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArray
 
Methods inherited from class com.google.common.collect.ForwardingObject
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
contains, containsAll, isEmpty, size, toArray, toArray
 

Constructor Detail

BoundedSet

public BoundedSet(Set<E> delegate,
                  int maximumSize)

BoundedSet

public BoundedSet(int maximumSize)
Creates a HashSet-backed bounded set.

Method Detail

delegate

protected Set<E> delegate()
Overrides:
delegate in class com.google.common.collect.ForwardingSet<E>

iterator

@NotNull
public Iterator<E> iterator()
The returned iterator does not support removal.

Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>
Overrides:
iterator in class com.google.common.collect.ForwardingCollection<E>

add

public boolean add(E e)
Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>
Overrides:
add in class com.google.common.collect.ForwardingCollection<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>
Overrides:
remove in class com.google.common.collect.ForwardingCollection<E>

addAll

public boolean addAll(@NotNull
                      Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>
Overrides:
addAll in class com.google.common.collect.ForwardingCollection<E>

retainAll

public boolean retainAll(@NotNull
                         Collection<?> c)
Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>
Overrides:
retainAll in class com.google.common.collect.ForwardingCollection<E>

removeAll

public boolean removeAll(@NotNull
                         Collection<?> c)
Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>
Overrides:
removeAll in class com.google.common.collect.ForwardingCollection<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>
Overrides:
clear in class com.google.common.collect.ForwardingCollection<E>

poll

@Nullable
public E poll()
See Queue.poll()



Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.