org.pcollections

## Class MapPBag<E>

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - org.pcollections.MapPBag<E>

Type Parameters:
  `E` -

All Implemented Interfaces:
  Iterable<E>, Collection<E>, PBag<E>, PCollection<E>

    public final class MapPBag<E>
    extends AbstractCollection<E>
    implements PBag<E>

A map-backed persistent bag.

If the backing map is thread-safe, then this implementation is thread-safe (assuming Java's AbstractCollection is thread-safe), although its iterators may not be.

### Method Summary

Methods
`boolean` `contains(Object e)`
`static <E> MapPBag<E>` `empty(PMap<E,Integer> map)`
`boolean` `equals(Object that)`
`int` `hashCode()`
`Iterator<E>` `iterator()`
`MapPBag<E>` `minus(Object e)`
`MapPBag<E>` `minusAll(Collection<?> list)`
`MapPBag<E>` `plus(E e)`
`MapPBag<E>` `plusAll(Collection<? extends E> list)`
`int` `size()`

### Methods inherited from class java.util.AbstractCollection

`add, addAll, clear, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.pcollections.PCollection

`add, addAll, clear, remove, removeAll, retainAll`

### Methods inherited from interface java.util.Collection

`containsAll, isEmpty, toArray, toArray`

### Method Detail

#### empty

    public static <E> MapPBag<E> empty(PMap<E,Integer> map)

Type Parameters:
  `E` -
Parameters:
  `map` -
Returns:
  a PBag backed by an empty version of map, i.e. by map.minusAll(map.keySet())

#### size

    public int size()

Specified by:
  `size` in interface `Collection<E>`
Specified by:
  `size` in class `AbstractCollection<E>`

#### iterator

    public Iterator<E> iterator()

Specified by:
  `iterator` in interface `Iterable<E>`
Specified by:
  `iterator` in interface `Collection<E>`
Specified by:
  `iterator` in class `AbstractCollection<E>`

#### contains

    public boolean contains(Object e)

Specified by:
  `contains` in interface `Collection<E>`
Overrides:
  `contains` in class `AbstractCollection<E>`

#### hashCode

    public int hashCode()

Specified by:
  `hashCode` in interface `Collection<E>`
Overrides:
  `hashCode` in class `Object`

#### equals

    public boolean equals(Object that)

Specified by:
  `equals` in interface `Collection<E>`
Overrides:
  `equals` in class `Object`

#### plus

    public MapPBag<E> plus(E e)

Specified by:
  `plus` in interface `PBag<E>`
Specified by:
  `plus` in interface `PCollection<E>`
Parameters:
  `e` - non-null
Returns:
  a collection which contains e and all of the elements of this

#### minus

    public MapPBag<E> minus(Object e)

Specified by:
  `minus` in interface `PBag<E>`
Specified by:
  `minus` in interface `PCollection<E>`
Returns:
  this with a single instance of e removed, if e is in this

#### plusAll

    public MapPBag<E> plusAll(Collection<? extends E> list)

Specified by:
  `plusAll` in interface `PBag<E>`
Specified by:
  `plusAll` in interface `PCollection<E>`
Parameters:
  `list` - contains no null elements
Returns:
  a collection which contains all of the elements of list and this

#### minusAll

    public MapPBag<E> minusAll(Collection<?> list)

Specified by:
  `minusAll` in interface `PBag<E>`
Specified by:
  `minusAll` in interface `PCollection<E>`
Returns:
  this with all elements of list completely removed

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015