## org.eclipse.emf.ocl.utilities.impl
Class Bag

    java.lang.Object
      java.util.AbstractCollection
          org.eclipse.emf.ocl.utilities.impl.Bag

All Implemented Interfaces:
  Iterable, Collection

    public final class Bag

extends AbstractCollection

A Bag is an unordered collection which may have duplicate elements.

Field Summary
`static Bag` `EMPTY_BAG`

Constructor Summary
`Bag()`
`Bag(Collection c)`

Method Summary
`boolean` `add(Object o)`
`void` `clear()`
`boolean` `equals(Object o)` Returns true iff this bag and the argument bag have the same number of the same elements.
`int` `hashCode()`
`Iterator` `iterator()`
`boolean` `remove(Object o)` removes every occurrence of the object from the collection
`int` `size()`
`String` `toString()`

Methods inherited from class java.util.AbstractCollection
`addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### EMPTY_BAG

    public static Bag EMPTY_BAG

Constructor Detail

### Bag

    public Bag()

### Bag

    public Bag(Collection c)

Method Detail

### remove

    public boolean remove(Object o)

  removes every occurrence of the object from the collection

  Specified by:
    `remove` in interface `Collection`
  Overrides:
    `remove` in class `AbstractCollection`

### add

    public boolean add(Object o)

  Specified by:
    `add` in interface `Collection`
  Overrides:
    `add` in class `AbstractCollection`

### size

    public int size()

  Specified by:
    `size` in interface `Collection`
  Specified by:
    `size` in class `AbstractCollection`

### clear

    public void clear()

  Specified by:
    `clear` in interface `Collection`
  Overrides:
    `clear` in class `AbstractCollection`

### equals

    public boolean equals(Object o)

  Returns true iff this bag and the argument bag have the same number of the same elements.

  Specified by:
    `equals` in interface `Collection`
  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `Collection`
  Overrides:
    `hashCode` in class `Object`

### iterator

    public Iterator iterator()

  Specified by:
    `iterator` in interface `Iterable`
  Specified by:
    `iterator` in interface `Collection`
  Specified by:
    `iterator` in class `AbstractCollection`

### toString

    public String toString()

  Overrides:
    `toString` in class `AbstractCollection`

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.