| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| private final T |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | allSatisfy(Predicate<? super T> predicate)
Overrides org. Implements org. Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. |
| public boolean | allSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate)
Implements org. Returns true if the predicate evaluates to true for all elements of the Bag. |
| public boolean | anySatisfy(Predicate<? super T> predicate)
Overrides org. Implements org. Returns true if the predicate evaluates to true for any element of the iterable. |
| public boolean | anySatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate)
Implements org. Returns true if the predicate evaluates to true for any element of the Bag. |
| public <V> ImmutableBag | collect(Function<? super T, ? extends V> function)
Implements org. Returns a new collection with the results of applying the specified function on each element of the source collection. |
| public <V> ImmutableBag | collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)
Implements org. Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate. |
| public <V, R extends Collection | collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function, R target)
Overrides org. Implements org. Same as the collectIf method with two parameters but uses the specified target collection for the results. |
| public <V, R extends Collection | collectWithOccurrences(ObjectIntToObjectFunction<? super T, ? extends V> function, R target)
Overrides default org. Iterates over the unique elements and their occurrences and collects the results of applying the specified function into the target collection. |
| public boolean | contains(Object object)
Overrides org. Implements org. Returns true if the iterable has an element which responds true to element.equals(object). |
| public boolean | containsAllArguments(Object... elements)
Overrides org. Implements org. Returns true if all elements in the specified var arg array are contained in this collection. |
| public boolean | containsAllIterable(Iterable<?> source)
Overrides org. Implements org. Returns true if all elements in source are contained in this collection. |
| public int | count(Predicate<? super T> predicate)
Overrides org. Implements org. Return the total number of elements that answer true to the specified predicate. |
| public T | detect(Predicate<? super T> predicate)
Overrides org. Implements org. Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true. |
| public T | detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)
Overrides default org. Returns the first element of the iterable for which the predicate evaluates to true. |
| public Optional | detectOptional(Predicate<? super T> predicate)
Overrides org. Implements org. Returns the first element of the iterable for which the predicate evaluates to true as an Optional. |
| public T | detectWithOccurrences(ObjectIntPredicate<? super T> predicate)
Implements org. Returns an element of the Bag that satisfies the predicate or null if such an element does not exist |
| public RichIterable | distinctView()
Overrides default org. Returns an unmodifiable view on the distinct elements with the same complexity as the Bag implementation. |
| public void | each(Procedure<? super T> procedure)
Implements org. The procedure is executed for each element in the iterable. |
| private ImmutableBag | |
| public boolean | equals(Object obj)
Overrides java. Implements org. Two bags |
| public <V> ImmutableBag | flatCollect(Function<? super T, ? extends Iterable<V>> function)
Implements org.
|
| public <V, R extends Collection | flatCollect(Function<? super T, ? extends Iterable<V>> function, R target)
Overrides org. Implements org. Same as flatCollect, only the results are collected into the target collection. |
| public <P> void | forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)
Overrides org. Implements org. The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument. |
| public void | forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
Overrides org. Implements org. Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure. |
| public void | forEachWithOccurrences(ObjectIntProcedure<? super T> objectIntProcedure)
Implements org. For each distinct item, with the number of occurrences, execute the specified procedure. |
| public T | getFirst()
Implements org. Returns the first element of an iterable. |
| public T | getLast()
Implements org. Returns the last element of an iterable. |
| public T | getOnly()
Overrides default org. Returns the element if the iterable has exactly one element. |
| public <V> ImmutableBagMultimap | groupBy(Function<? super T, ? extends V> function)
Implements org. For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable. |
| public <V, R extends MutableMultimap | groupBy(Function<? super T, ? extends V> function, R target)
Overrides org. Implements org. Same as |
| public <V> ImmutableBagMultimap | groupByEach(Function<? super T, ? extends Iterable<V>> function)
Implements org. Similar to |
| public <V, R extends MutableMultimap | groupByEach(Function<? super T, ? extends Iterable<V>> function, R target)
Overrides org. Implements org. Same as |
| public int | hashCode()
Overrides java. Implements org. Returns the hash code for this Bag, defined as this. |
| public <IV> IV | injectInto(IV injectedValue, Function2<? super IV, ? super T, ? extends IV> function)
Overrides org. Implements org. Returns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. |
| public boolean | isEmpty()
Overrides org. Implements org. Returns true if this iterable has zero items. |
| public Iterator | iterator()
Implements java. Returns an iterator over elements of type |
| public T | max(Comparator<? super T> comparator)
Overrides org. Implements org. Returns the maximum element out of this container based on the comparator. |
| public T | max()
Overrides org. Implements org. Returns the maximum element out of this container based on the natural order. |
| public <V extends Comparable | maxBy(Function<? super T, ? extends V> function)
Overrides org. Implements org. Returns the maximum elements out of this container based on the natural order of the attribute returned by Function. |
| public T | min(Comparator<? super T> comparator)
Overrides org. Implements org. Returns the minimum element out of this container based on the comparator. |
| public T | min()
Overrides org. Implements org. Returns the minimum element out of this container based on the natural order. |
| public <V extends Comparable | minBy(Function<? super T, ? extends V> function)
Overrides org. Implements org. Returns the minimum elements out of this container based on the natural order of the attribute returned by Function. |
| public ImmutableBag | newWith(T element)
Implements org. This method is similar to the |
| public ImmutableBag | newWithAll(Iterable<? extends T> elements)
Implements org. This method is similar to the |
| public ImmutableBag | newWithout(T element)
Implements org. This method is similar to the |
| public ImmutableBag | newWithoutAll(Iterable<? extends T> elements)
Overrides org. Implements org. This method is similar to the |
| public boolean | noneSatisfy(Predicate<? super T> predicate)
Overrides org. Implements org. Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. |
| public boolean | noneSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate)
Implements org. Returns true if the Bag is empty or if the predicate evaluates to false for all elements of the Bag. |
| public boolean | notEmpty()
Overrides default org. The English equivalent of !this.isEmpty() |
| public int | occurrencesOf(Object item)
Implements org. The occurrences of a distinct item in the bag. |
| public ImmutableBag | reject(Predicate<? super T> predicate)
Implements org. Returns all elements of the source collection that return false when evaluating of the predicate. |
| public <R extends Collection | reject(Predicate<? super T> predicate, R target)
Overrides org. Implements org. Same as the reject method with one parameter but uses the specified target collection for the results. |
| public <P, R extends Collection | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter, R target)
Overrides org. Implements org. Similar to |
| public ImmutableBag | select(Predicate<? super T> predicate)
Implements org. Returns all elements of the source collection that return true when evaluating the predicate. |
| public <R extends Collection | select(Predicate<? super T> predicate, R target)
Overrides org. Implements org. Same as the select method with one parameter but uses the specified target collection for the results. |
| public ImmutableBag | selectByOccurrences(IntPredicate predicate)
Implements org. Returns all elements of the bag that have a number of occurrences that satisfy the predicate. |
| public <S> ImmutableBag | selectInstancesOf(Class<S> clazz)
Implements org. Returns all elements of the source collection that are instances of the Class |
| public ImmutableSet | selectUnique()
Overrides default org. Implements org. Returns a set containing all elements of the bag that have exactly one occurrence. |
| public <P, R extends Collection | selectWith(Predicate2<? super T, ? super P> predicate, P parameter, R target)
Overrides org. Implements org. Similar to |
| public int | size()
Implements org. Returns the number of items in this iterable. |
| public int | sizeDistinct()
Implements org. The size of the Bag when counting only distinct elements. |
| public MutableMap | toMapOfItemToCount()
Implements org. Converts the Bag to a Map of the Item type to its count as an Integer. |
| public String | toString()
Overrides org. Implements org. Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets. |
| private Object | |
| public <S> ImmutableBag | zip(Iterable<S> that)
Implements org.
Deprecated
in 6.0. Use
OrderedIterable#zip(Iterable) instead.
Returns a |
| public ImmutableSet | zipWithIndex()
Implements org.
Deprecated
in 6.0. Use
OrderedIterable#zipWithIndex() instead.
Zips this |