BRUtil - Making Java a Kinder, Gentler, Place to be.

brutil
Class AbstractMultiSet

java.lang.Object
  |
  +--brutil.AbstractListing
        |
        +--brutil.AbstractMultiSet
All Implemented Interfaces:
Collection, MultiSet, Set
Direct Known Subclasses:
AbstractSet, AbstractSortedMultiSet, ArrayMultiSet, LinkedMultiSet

public abstract class AbstractMultiSet
extends AbstractListing
implements MultiSet

Same as the Set interface, only a MultiSet may contain more than one instance of a single object.


Fields inherited from class brutil.AbstractListing
list
 
Constructor Summary
AbstractMultiSet()
           
 
Method Summary
 java.lang.Object add(java.lang.Object elt)
          Add the specified object to the Set.
 boolean contains(java.lang.Object elt)
          Tells if the specified object is contained within this set.
 java.lang.Object find(java.lang.Object elt)
           
 java.util.Iterator iterator()
          Returns an iterator over the elements in the set.
 int numOccurences(java.lang.Object elt)
          Return the number of times the specified object occurs in the set.
 java.lang.Object remove(java.lang.Object elt)
          Removes the specified object from the Set, if present.
 boolean removeAll(java.lang.Object elt)
          Remove all instances of specified object from the MultiSet
 
Methods inherited from class brutil.AbstractListing
clear, isEmpty, listFactory, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface brutil.Set
isEmpty
 
Methods inherited from interface brutil.Collection
clear, size
 

Constructor Detail

AbstractMultiSet

public AbstractMultiSet()
Method Detail

find

public java.lang.Object find(java.lang.Object elt)
Specified by:
find in interface Set
Returns:
the contained item that matches the parameter with respect to its .equals()

contains

public boolean contains(java.lang.Object elt)
Tells if the specified object is contained within this set.
Specified by:
contains in interface Set
Parameters:
elt - The object to search for in the Set.
Returns:
true if the object is contained in the set, false otherwise.

iterator

public java.util.Iterator iterator()
Returns an iterator over the elements in the set.
Specified by:
iterator in interface Set
Returns:
An iterator of the elements in the set.

remove

public java.lang.Object remove(java.lang.Object elt)
Removes the specified object from the Set, if present.
Specified by:
remove in interface Set
Parameters:
elt - The object to remove.
Returns:
true if the object was in the Set, false otherwise.

removeAll

public boolean removeAll(java.lang.Object elt)
Remove all instances of specified object from the MultiSet
Specified by:
removeAll in interface MultiSet
Parameters:
o - The object to remove.
Returns:
true if the object was in the set, false otherwise.

numOccurences

public int numOccurences(java.lang.Object elt)
Return the number of times the specified object occurs in the set.
Specified by:
numOccurences in interface MultiSet
Parameters:
o - The object to find the number of instance to
Returns:
number of instances of the specified object.

add

public java.lang.Object add(java.lang.Object elt)
Add the specified object to the Set. Unless the implementing class is also a MultiSet, there may only be one instance of the object in the set.
Specified by:
add in interface Set
Parameters:
o - The object to add to the Set.
Returns:
Object that was just added to the set.


BRUtil - Making Java a Kinder, Gentler, Place to be.