# Uses of Interface
org.apache.commons.collections4.Bag

Packages that use Bag
Package
Description
org.apache.commons.collections4
Interfaces and utilities shared across all packages.
org.apache.commons.collections4.bag
Implements the `Bag` and `SortedBag` interfaces.
org.apache.commons.collections4.collection
Implementations of the `Collection` interface.

- ## Uses of Bag in org.apache.commons.collections4

  Subinterfaces of Bag in org.apache.commons.collections4
  Modifier and Type
  Interface
  Description
  `interface`
  `SortedBag<E>`
  Defines a type of `Bag` that maintains a sorted order among its unique representative members.
  Fields in org.apache.commons.collections4 declared as Bag
  Modifier and Type
  Field
  Description
  `static final Bag`
  BagUtils.`EMPTY_BAG`
  An empty unmodifiable bag.
  `static final Bag`
  BagUtils.`EMPTY_SORTED_BAG`
  An empty unmodifiable sorted bag.
  Methods in org.apache.commons.collections4 that return Bag
  Modifier and Type
  Method
  Description
  `static <E> Bag<E>`
  BagUtils.`collectionBag(Bag<E> bag)`
  Returns a bag that complies to the Collection contract, backed by the given bag.
  `static <E> Bag<E>`
  BagUtils.`emptyBag()`
  Gets an empty `Bag`.
  `static <K, V> Bag<V>`
  MultiMapUtils.`getValuesAsBag(MultiValuedMap<K,V> map, K key)`
  Gets a Bag from `MultiValuedMap` in a null-safe manner.
  `static <E> Bag<E>`
  BagUtils.`predicatedBag(Bag<E> bag, Predicate<? super E> predicate)`
  Returns a predicated (validating) bag backed by the given bag.
  `static <E> Bag<E>`
  BagUtils.`synchronizedBag(Bag<E> bag)`
  Returns a synchronized (thread-safe) bag backed by the given bag.
  `static <E> Bag<E>`
  BagUtils.`transformingBag(Bag<E> bag, Transformer<? super E,? extends E> transformer)`
  Returns a transformed bag backed by the given bag.
  `static <E> Bag<E>`
  BagUtils.`unmodifiableBag(Bag<? extends E> bag)`
  Returns an unmodifiable view of the given bag.
  Methods in org.apache.commons.collections4 with parameters of type Bag
  Modifier and Type
  Method
  Description
  `static <E> Bag<E>`
  BagUtils.`collectionBag(Bag<E> bag)`
  Returns a bag that complies to the Collection contract, backed by the given bag.
  `static <E> Bag<E>`
  BagUtils.`predicatedBag(Bag<E> bag, Predicate<? super E> predicate)`
  Returns a predicated (validating) bag backed by the given bag.
  `static <E> Bag<E>`
  BagUtils.`synchronizedBag(Bag<E> bag)`
  Returns a synchronized (thread-safe) bag backed by the given bag.
  `static <E> Bag<E>`
  BagUtils.`transformingBag(Bag<E> bag, Transformer<? super E,? extends E> transformer)`
  Returns a transformed bag backed by the given bag.
  `static <E> Bag<E>`
  BagUtils.`unmodifiableBag(Bag<? extends E> bag)`
  Returns an unmodifiable view of the given bag.

- ## Uses of Bag in org.apache.commons.collections4.bag

  Classes in org.apache.commons.collections4.bag that implement Bag
  Modifier and Type
  Class
  Description
  `class`
  `AbstractBagDecorator<E>`
  Decorates another `Bag` to provide additional behavior.
  `class`
  `AbstractMapBag<E>`
  Abstract implementation of the `Bag` interface to simplify the creation of subclass implementations.
  `class`
  `AbstractSortedBagDecorator<E>`
  Decorates another `SortedBag` to provide additional behavior.
  `final class`
  `CollectionBag<E>`
  Decorates another `Bag` to comply with the Collection contract.
  `final class`
  `CollectionSortedBag<E>`
  Decorates another `SortedBag` to comply with the Collection contract.
  `class`
  `HashBag<E>`
  Implements `Bag`, using a `HashMap` to provide the data storage.
  `class`
  `PredicatedBag<E>`
  Decorates another `Bag` to validate that additions match a specified predicate.
  `class`
  `PredicatedSortedBag<E>`
  Decorates another `SortedBag` to validate that additions match a specified predicate.
  `class`
  `SynchronizedBag<E>`
  Decorates another `Bag` to synchronize its behavior for a multithreaded environment.
  `class`
  `SynchronizedSortedBag<E>`
  Decorates another `SortedBag` to synchronize its behavior for a multithreaded environment.
  `class`
  `TransformedBag<E>`
  Decorates another `Bag` to transform objects that are added.
  `class`
  `TransformedSortedBag<E>`
  Decorates another `SortedBag` to transform objects that are added.
  `class`
  `TreeBag<E>`
  Implements `SortedBag`, using a `TreeMap` to provide the data storage.
  `final class`
  `UnmodifiableBag<E>`
  Decorates another `Bag` to ensure it can't be altered.
  `final class`
  `UnmodifiableSortedBag<E>`
  Decorates another `SortedBag` to ensure it can't be altered.
  Methods in org.apache.commons.collections4.bag that return Bag
  Modifier and Type
  Method
  Description
  `static <E> Bag<E>`
  CollectionBag.`collectionBag(Bag<E> bag)`
  Factory method to create a bag that complies to the Collection contract.
  `protected Bag<E>`
  AbstractBagDecorator.`decorated()`
  Gets the bag being decorated.
  `protected Bag<E>`
  PredicatedBag.`decorated()`
  Gets the decorated bag.
  `protected Bag<E>`
  SynchronizedBag.`getBag()`
  Gets the bag being decorated.
  `protected Bag<E>`
  TransformedBag.`getBag()`
  Gets the decorated bag.
  `static <E> Bag<E>`
  TransformedBag.`transformedBag(Bag<E> bag, Transformer<? super E,? extends E> transformer)`
  Factory method to create a transforming bag that will transform existing contents of the specified bag.
  `static <E> Bag<E>`
  TransformedBag.`transformingBag(Bag<E> bag, Transformer<? super E,? extends E> transformer)`
  Factory method to create a transforming bag.
  `static <E> Bag<E>`
  UnmodifiableBag.`unmodifiableBag(Bag<? extends E> bag)`
  Factory method to create an unmodifiable bag.
  Methods in org.apache.commons.collections4.bag with parameters of type Bag
  Modifier and Type
  Method
  Description
  `static <E> Bag<E>`
  CollectionBag.`collectionBag(Bag<E> bag)`
  Factory method to create a bag that complies to the Collection contract.
  `static <E> PredicatedBag<E>`
  PredicatedBag.`predicatedBag(Bag<E> bag, Predicate<? super E> predicate)`
  Factory method to create a predicated (validating) bag.
  `static <E> SynchronizedBag<E>`
  SynchronizedBag.`synchronizedBag(Bag<E> bag)`
  Factory method to create a synchronized bag.
  `static <E> Bag<E>`
  TransformedBag.`transformedBag(Bag<E> bag, Transformer<? super E,? extends E> transformer)`
  Factory method to create a transforming bag that will transform existing contents of the specified bag.
  `static <E> Bag<E>`
  TransformedBag.`transformingBag(Bag<E> bag, Transformer<? super E,? extends E> transformer)`
  Factory method to create a transforming bag.
  `static <E> Bag<E>`
  UnmodifiableBag.`unmodifiableBag(Bag<? extends E> bag)`
  Factory method to create an unmodifiable bag.
  Constructors in org.apache.commons.collections4.bag with parameters of type Bag
  Modifier
  Constructor
  Description
  `protected`
  `AbstractBagDecorator(Bag<E> bag)`
  Constructor that wraps (not copies).
  ``
  `CollectionBag(Bag<E> bag)`
  Constructor that wraps (not copies).
  `protected`
  `PredicatedBag(Bag<E> bag, Predicate<? super E> predicate)`
  Constructor that wraps (not copies).
  `protected`
  `SynchronizedBag(Bag<E> bag)`
  Constructor that wraps (not copies).
  `protected`
  `SynchronizedBag(Bag<E> bag, Object lock)`
  Constructor that wraps (not copies).
  `protected`
  `SynchronizedSortedBag(Bag<E> bag, Object lock)`
  Constructor that wraps (not copies).
  `protected`
  `TransformedBag(Bag<E> bag, Transformer<? super E,? extends E> transformer)`
  Constructor that wraps (not copies).

- ## Uses of Bag in org.apache.commons.collections4.collection

  Methods in org.apache.commons.collections4.collection that return Bag
  Modifier and Type
  Method
  Description
  `Bag<E>`
  PredicatedCollection.Builder.`createPredicatedBag()`
  Create a new predicated bag filled with the accepted elements.
  `Bag<E>`
  PredicatedCollection.Builder.`createPredicatedBag(Bag<E> bag)`
  Decorates the given bag with validating behavior using the predicate.
  Methods in org.apache.commons.collections4.collection with parameters of type Bag
  Modifier and Type
  Method
  Description
  `Bag<E>`
  PredicatedCollection.Builder.`createPredicatedBag(Bag<E> bag)`
  Decorates the given bag with validating behavior using the predicate.