E - The type of element managed by the collection.public class Bag<E> extends OrderedCollection<E>
| Constructor and Description |
|---|
Bag()
This constructor creates a new empty bag with no comparator function.
|
Bag(java.util.Comparator<? super E> comparator)
This constructor creates a new bag with the specified comparator function.
|
Bag(E[] elements)
This constructor creates a new bag with no comparator function and seeds
it with the elements from the specified array.
|
Bag(E[] elements,
java.util.Comparator<? super E> comparator)
This constructor creates a new bag with the specified comparator function and seeds
it with the elements from the specified array.
|
Bag(java.lang.Iterable<? extends E> elements)
This constructor creates a new bag with no comparator function and seeds
it with the elements from the specified collection.
|
Bag(java.lang.Iterable<? extends E> elements,
java.util.Comparator<? super E> comparator)
This constructor creates a new bag with the specified comparator function and seeds
it with the elements from the specified collection.
|
| Modifier and Type | Method and Description |
|---|---|
static <E> Bag<E> |
aggregate(Bag<E> bag1,
Bag<E> bag2)
This function returns a new bag that contains the all the elements from
both the specified bags.
|
Bag<E> |
copy() |
static <E> Bag<E> |
difference(Bag<E> bag1,
Bag<E> bag2)
This function returns a new bag that contains the elements that are
in the first bag but not contained in the second bag specified.
|
E[] |
toArray() |
addElement, createIterator, getComparator, getElement, getElements, getIndex, getSize, removeAll, removeElementaddElements, addElements, removeElements, removeElementscontainsAll, containsAny, containsElement, normalizedIndexcompareTo, equals, hashCodeaddSerializableClass, addSerializableClass, addSerializableClass, createMapper, fromString, fromString, toExposedString, toString, toString, toString, toStringpublic Bag()
public Bag(E[] elements)
elements - The elements to be used to seed the new bag.public Bag(java.lang.Iterable<? extends E> elements)
elements - The elements to be used to seed the new bag.public Bag(java.util.Comparator<? super E> comparator)
comparator - The comparator to be used to compare two elements during ordering.public Bag(E[] elements, java.util.Comparator<? super E> comparator)
elements - The elements to be used to seed the new bag.comparator - The comparator to be used to compare two elements during ordering.public Bag(java.lang.Iterable<? extends E> elements, java.util.Comparator<? super E> comparator)
elements - The elements to be used to seed the new bag.comparator - The comparator to be used to compare two elements during ordering.public E[] toArray()
public static <E> Bag<E> aggregate(Bag<E> bag1, Bag<E> bag2)
E - The type of element contained in the bags.bag1 - The first bag whose elements are to be added.bag2 - The second bag whose elements are to be added.public static <E> Bag<E> difference(Bag<E> bag1, Bag<E> bag2)
E - The type of element contained in the bags.bag1 - The bag whose elements are to be removed.bag2 - The bag whose elements are to be removed.Copyright © 2016 Crater Dog Technologies(TM). All rights reserved.