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 |
|---|---|
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.
|
static <E> Bag<E> |
merge(Bag<E> bag1,
Bag<E> bag2)
This function returns a new bag that contains the all the elements from
both the specified bags.
|
E[] |
toArray() |
addElement, createDefaultIterator, getComparator, getElementAtIndex, getElementsInRange, getIndexOfElement, getNumberOfElements, removeAllElements, removeElementaddElements, addElements, removeElements, removeElementscompareTo, containsAllElementsIn, containsAnyElementsIn, containsElement, equals, hashCode, isEmpty, iterator, normalizedIndexaddSerializableClass, addSerializableClass, toExposedString, 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()
toArray in interface Sequential<E>toArray in class Collection<E>public Bag<E> copy()
copy in class craterdog.smart.SmartObject<Collection<E>>public static <E> Bag<E> merge(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 © 2015 Crater Dog Technologies(TM). All rights reserved.