org.eclipse.ocl.examples.eventmanager.util
Interface Bag<E>

All Superinterfaces:
java.util.Collection<E>, java.lang.Iterable<E>
All Known Implementing Classes:
BagImpl, CompositeBag, EmptyBag, SingleSetAsBag

public interface Bag<E>
extends java.util.Collection<E>

A bag is a read-only collection that is non-unique and unordered. It is, therefore, like a set except that any element may occur multiple times. All modifying operations will throw an UnsupportedOperationException.

Note, that no specific Object.equals(Object) or Object.hashCode() requirements are added by this interface. This means that implementations may simply use the Object-provided, identity-based comparison semantics.

Author:
Christian W. Damus (cdamus), Axel Uhl

Method Summary
 int count(java.lang.Object o)
          Queries how many times the specified object occurs in me.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

count

int count(java.lang.Object o)
Queries how many times the specified object occurs in me. If I do not contain the object, then the count is zero.

Parameters:
o - an object
Returns:
the number of times that it occurs in me