Class ImmutableHashBag<T>
- All Implemented Interfaces:
Serializable,Iterable<T>,Collection<T>,Bag<T>,ImmutableBag<T>,ImmutableBagIterable<T>,UnsortedBag<T>,ImmutableCollection<T>,InternalIterable<T>,RichIterable<T>
public class ImmutableHashBag<T> extends AbstractImmutableBag<T> implements Serializable
- Since:
- 1.0
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description ImmutableHashBag()ImmutableHashBag(Iterable<? extends T> source)ImmutableHashBag(Bag<? extends T> source) -
Method Summary
Modifier and Type Method Description booleanallSatisfy(Predicate<? super T> predicate)Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty.<P> booleanallSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)Returns true if the predicate evaluates to true for every element of the collection, or returns false.booleananySatisfy(Predicate<? super T> predicate)Returns true if the predicate evaluates to true for any element of the iterable.<P> booleananySatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)Returns true if the predicate evaluates to true for any element of the collection, or return false.voidappendString(Appendable appendable)Prints a string representation of this collection onto the givenAppendable.voidappendString(Appendable appendable, String separator)Prints a string representation of this collection onto the givenAppendable.voidappendString(Appendable appendable, String start, String separator, String end)Prints a string representation of this collection onto the givenAppendable.LazyIterable<T>asLazy()Returns a lazy (deferred) iterable, most likely implemented by calling LazyIterate.adapt(this).<V> ImmutableBag<V>collect(Function<? super T,? extends V> function)Returns a new collection with the results of applying the specified function on each element of the source collection.<V, R extends Collection<V>>
Rcollect(Function<? super T,? extends V> function, R target)Same asRichIterable.collect(Function), except that the results are gathered into the specifiedtargetcollection.<V> ImmutableBag<V>collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)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.<V, R extends Collection<V>>
RcollectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function, R target)Same as the collectIf method with two parameters but uses the specified target collection for the results.booleancontains(Object object)Returns true if the iterable has an element which responds true to element.equals(object).booleancontainsAllArguments(Object... elements)Returns true if all elements in the specified var arg array are contained in this collection.booleancontainsAllIterable(Iterable<?> source)Returns true if all elements in source are contained in this collection.intcount(Predicate<? super T> predicate)Return the total number of elements that answer true to the specified predicate.Tdetect(Predicate<? super T> predicate)Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true.TdetectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)Returns the first element of the iterable for which the predicate evaluates to true.Optional<T>detectOptional(Predicate<? super T> predicate)Returns the first element of the iterable for which the predicate evaluates to true as an Optional.<P> TdetectWith(Predicate2<? super T,? super P> predicate, P parameter)Returns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true.<P> Optional<T>detectWithOptional(Predicate2<? super T,? super P> predicate, P parameter)Returns the first element that evaluates to true for the specified predicate2 and parameter as an Optional.voideach(Procedure<? super T> procedure)The procedure is executed for each element in the iterable.booleanequals(Object obj)Two bagsb1andb2are equal ifm1.toMapOfItemToCount().equals(m2.toMapOfItemToCount()).<V> ImmutableBag<V>flatCollect(Function<? super T,? extends Iterable<V>> function)flatCollectis a special case ofRichIterable.collect(Function).<V, R extends Collection<V>>
RflatCollect(Function<? super T,? extends Iterable<V>> function, R target)Same as flatCollect, only the results are collected into the target collection.voidforEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.voidforEachWithOccurrences(ObjectIntProcedure<? super T> objectIntProcedure)For each distinct item, with the number of occurrences, execute the specified procedure.TgetFirst()Returns the first element of an iterable.TgetLast()Returns the last element of an iterable.TgetOnly()Returns the element if the iterable has exactly one element.<V> ImmutableBagMultimap<V,T>groupBy(Function<? super T,? extends V> function)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.<V, R extends MutableMultimap<V, T>>
RgroupBy(Function<? super T,? extends V> function, R target)Same asRichIterable.groupBy(Function), except that the results are gathered into the specifiedtargetmultimap.<V> ImmutableBagMultimap<V,T>groupByEach(Function<? super T,? extends Iterable<V>> function)Similar toRichIterable.groupBy(Function), except the result of evaluating function will return a collection of keys for each value.<V, R extends MutableMultimap<V, T>>
RgroupByEach(Function<? super T,? extends Iterable<V>> function, R target)Same asRichIterable.groupByEach(Function), except that the results are gathered into the specifiedtargetmultimap.<V> ImmutableMap<V,T>groupByUniqueKey(Function<? super T,? extends V> function)For each element of the iterable, the function is evaluated and he results of these evaluations are collected into a new map, where the transformed value is the key.inthashCode()Returns the hash code for this Bag, defined as this.Bag.toMapOfItemToCount().hashCode().doubleinjectInto(double injectedValue, DoubleObjectToDoubleFunction<? super T> function)Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.floatinjectInto(float injectedValue, FloatObjectToFloatFunction<? super T> function)Returns the final float result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.intinjectInto(int injectedValue, IntObjectToIntFunction<? super T> function)Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.longinjectInto(long injectedValue, LongObjectToLongFunction<? super T> function)Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.<IV> IVinjectInto(IV injectedValue, Function2<? super IV,? super T,? extends IV> function)Returns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.booleanisEmpty()Returns true if this iterable has zero items.Iterator<T>iterator()StringmakeString()Returns a string representation of this collection by delegating toRichIterable.makeString(String)and defaulting the separator parameter to the characters", "(comma and space).StringmakeString(String separator)Returns a string representation of this collection by delegating toRichIterable.makeString(String, String, String)and defaulting the start and end parameters to""(the empty String).StringmakeString(String start, String separator, String end)Returns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.Tmax()Returns the maximum element out of this container based on the natural order.Tmax(Comparator<? super T> comparator)Returns the maximum element out of this container based on the comparator.<V extends Comparable<? super V>>
TmaxBy(Function<? super T,? extends V> function)Returns the maximum elements out of this container based on the natural order of the attribute returned by Function.Tmin()Returns the minimum element out of this container based on the natural order.Tmin(Comparator<? super T> comparator)Returns the minimum element out of this container based on the comparator.<V extends Comparable<? super V>>
TminBy(Function<? super T,? extends V> function)Returns the minimum elements out of this container based on the natural order of the attribute returned by Function.static <T> ImmutableHashBag<T>newBag()static <T> ImmutableHashBag<T>newBag(Iterable<? extends T> source)static <T> ImmutableHashBag<T>newBagWith(Bag<? extends T> bag)static <T> ImmutableHashBag<T>newBagWith(T... elements)ImmutableBag<T>newWith(T element)This method is similar to thewithmethod inMutableCollectionwith the difference that a new copy of this collection with the element appended will be returned.ImmutableBag<T>newWithAll(Iterable<? extends T> elements)This method is similar to thewithAllmethod inMutableCollectionwith the difference that a new copy of this collection with the elements appended will be returned.ImmutableBag<T>newWithout(T element)This method is similar to thewithoutmethod inMutableCollectionwith the difference that a new copy of this collection with the element removed will be returned.booleannoneSatisfy(Predicate<? super T> predicate)Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty.<P> booleannoneSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)Returns true if the predicate evaluates to false for every element of the collection, or return false.booleannotEmpty()The English equivalent of !this.isEmpty()intoccurrencesOf(Object item)The occurrences of a distinct item in the bag.PartitionImmutableBag<T>partition(Predicate<? super T> predicate)Filters a collection into a PartitionedIterable based on the evaluation of the predicate.ImmutableBag<T>reject(Predicate<? super T> predicate)Returns all elements of the source collection that return false when evaluating of the predicate.<R extends Collection<T>>
Rreject(Predicate<? super T> predicate, R target)Same as the reject method with one parameter but uses the specified target collection for the results.ImmutableBag<T>select(Predicate<? super T> predicate)Returns all elements of the source collection that return true when evaluating the predicate.<R extends Collection<T>>
Rselect(Predicate<? super T> predicate, R target)Same as the select method with one parameter but uses the specified target collection for the results.ImmutableBag<T>selectByOccurrences(IntPredicate predicate)Returns all elements of the bag that have a number of occurrences that satisfy the predicate.<S> ImmutableBag<S>selectInstancesOf(Class<S> clazz)Returns all elements of the source collection that are instances of the Classclazz.intsize()Returns the number of items in this iterable.intsizeDistinct()The size of the Bag when counting only distinct elements.Object[]toArray()Converts this iterable to an array.<T> T[]toArray(T[] a)Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.MutableBag<T>toBag()Converts the collection to the default MutableBag implementation.MutableList<T>toList()Converts the collection to a MutableList implementation.<K, V> MutableMap<K,V>toMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)Converts the collection to a MutableMap implementation using the specified key and value functions.<K, V, R extends Map<K, V>>
RtoMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction, R target)Same asRichIterable.toMap(Function, Function), except that the results are gathered into the specifiedtargetmap.MutableMap<T,Integer>toMapOfItemToCount()Converts the Bag to a Map of the Item type to its count as an Integer.MutableSet<T>toSet()Converts the collection to a MutableSet implementation.MutableSortedBag<T>toSortedBag()Converts the collection to a MutableSortedBag implementation and sorts it using the natural order of the elements.MutableSortedBag<T>toSortedBag(Comparator<? super T> comparator)Converts the collection to the MutableSortedBag implementation and sorts it using the specified comparator.<V extends Comparable<? super V>>
MutableSortedBag<T>toSortedBagBy(Function<? super T,? extends V> function)Converts the collection to a MutableSortedBag implementation and sorts it based on the natural order of the attribute returned byfunction.MutableList<T>toSortedList()Converts the collection to a MutableList implementation and sorts it using the natural order of the elements.MutableList<T>toSortedList(Comparator<? super T> comparator)Converts the collection to a MutableList implementation and sorts it using the specified comparator.<K, V> MutableSortedMap<K,V>toSortedMap(Comparator<? super K> comparator, Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)Converts the collection to a MutableSortedMap implementation using the specified key and value functions sorted by the given comparator.<K, V> MutableSortedMap<K,V>toSortedMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)Converts the collection to a MutableSortedMap implementation using the specified key and value functions sorted by the key elements' natural ordering.<KK extends Comparable<? super KK>, K, V>
MutableSortedMap<K,V>toSortedMapBy(Function<? super K,KK> sortBy, Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)Converts the collection to a MutableSortedMap implementation using the specified key and value functions and sorts it based on the natural order of the attribute returned bysortByfunction.MutableSortedSet<T>toSortedSet()Converts the collection to a MutableSortedSet implementation and sorts it using the natural order of the elements.MutableSortedSet<T>toSortedSet(Comparator<? super T> comparator)Converts the collection to a MutableSortedSet implementation and sorts it using the specified comparator.StringtoString()Returns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.<S> ImmutableBag<Pair<T,S>>zip(Iterable<S> that)Deprecated.in 6.0.<S, R extends Collection<Pair<T, S>>>
Rzip(Iterable<S> that, R target)Same asRichIterable.zip(Iterable)but usestargetfor output.ImmutableSet<Pair<T,Integer>>zipWithIndex()Deprecated.in 6.0.<R extends Collection<Pair<T, Integer>>>
RzipWithIndex(R target)Same asRichIterable.zipWithIndex()but usestargetfor output.Methods inherited from class org.eclipse.collections.impl.bag.immutable.AbstractImmutableBag
bottomOccurrences, chunk, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, collectWith, collectWithOccurrences, countBy, countByEach, countByWith, newWithoutAll, partitionWith, rejectWith, selectWith, tap, toImmutable, topOccurrencesMethods inherited from class org.eclipse.collections.impl.bag.immutable.AbstractImmutableBagIterable
add, addAll, aggregateInPlaceBy, castToCollection, clear, parallelStream, remove, removeAll, retainAll, spliterator, stream, sumByDouble, sumByFloat, sumByInt, sumByLongMethods inherited from class org.eclipse.collections.impl.bag.AbstractBag
collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, collectWith, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, injectIntoWith, rejectWith, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toStringOfItemToCountMethods inherited from class org.eclipse.collections.impl.AbstractRichIterable
containsAll, countWith, detectWithIfNone, forEach, forEachWith, groupByUniqueKey, into, toBiMap, toSortedListBy, toSortedSetByMethods inherited from interface org.eclipse.collections.api.bag.Bag
aggregateBy, collectWithOccurrences, reduceInPlace, reduceInPlace, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, toStringOfItemToCountMethods inherited from interface org.eclipse.collections.api.bag.ImmutableBag
flatCollectWith, selectDuplicates, selectUniqueMethods inherited from interface org.eclipse.collections.api.bag.ImmutableBagIterable
selectDuplicates, selectUniqueMethods inherited from interface org.eclipse.collections.api.collection.ImmutableCollection
aggregateBy, aggregateInPlaceBy, castToCollection, flatCollectWith, parallelStream, spliterator, stream, sumByDouble, sumByFloat, sumByInt, sumByLongMethods inherited from interface org.eclipse.collections.api.RichIterable
collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, collectWith, containsAll, containsBy, countBy, countByEach, countByWith, countWith, detectWithIfNone, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, groupByAndCollect, groupByUniqueKey, into, maxByOptional, maxOptional, maxOptional, minByOptional, minOptional, minOptional, reduce, rejectWith, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBiMap, toSortedListBy, toSortedSetBy
-
Constructor Details
-
ImmutableHashBag
public ImmutableHashBag() -
ImmutableHashBag
-
ImmutableHashBag
-
-
Method Details
-
newBag
-
newBag
-
newBagWith
-
newBagWith
-
newWith
Description copied from interface:ImmutableCollectionThis method is similar to thewithmethod inMutableCollectionwith the difference that a new copy of this collection with the element appended will be returned.- Specified by:
newWithin interfaceImmutableBag<T>- Specified by:
newWithin interfaceImmutableCollection<T>
-
newWithout
Description copied from interface:ImmutableCollectionThis method is similar to thewithoutmethod inMutableCollectionwith the difference that a new copy of this collection with the element removed will be returned.- Specified by:
newWithoutin interfaceImmutableBag<T>- Specified by:
newWithoutin interfaceImmutableCollection<T>
-
newWithAll
Description copied from interface:ImmutableCollectionThis method is similar to thewithAllmethod inMutableCollectionwith the difference that a new copy of this collection with the elements appended will be returned.- Specified by:
newWithAllin interfaceImmutableBag<T>- Specified by:
newWithAllin interfaceImmutableCollection<T>
-
size
public int size()Description copied from interface:RichIterableReturns the number of items in this iterable.- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceRichIterable<T>
-
groupBy
Description copied from interface:RichIterableFor 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.Example using a Java 8 method reference:
Multimap<String, Person> peopleByLastName = people.groupBy(Person::getLastName);Example using an anonymous inner class:
Multimap<String, Person> peopleByLastName = people.groupBy(new Function<Person, String>() { public String valueOf(Person person) { return person.getLastName(); } });- Specified by:
groupByin interfaceBag<T>- Specified by:
groupByin interfaceImmutableBag<T>- Specified by:
groupByin interfaceImmutableBagIterable<T>- Specified by:
groupByin interfaceImmutableCollection<T>- Specified by:
groupByin interfaceRichIterable<T>- Specified by:
groupByin interfaceUnsortedBag<T>
-
groupBy
public <V, R extends MutableMultimap<V, T>> R groupBy(Function<? super T,? extends V> function, R target)Description copied from interface:RichIterableSame asRichIterable.groupBy(Function), except that the results are gathered into the specifiedtargetmultimap.Example using a Java 8 method reference:
FastListMultimap<String, Person> peopleByLastName = people.groupBy(Person::getLastName, new FastListMultimap<String, Person>());Example using an anonymous inner class:
FastListMultimap<String, Person> peopleByLastName = people.groupBy(new Function<Person, String>() { public String valueOf(Person person) { return person.getLastName(); } }, new FastListMultimap<String, Person>());- Specified by:
groupByin interfaceRichIterable<T>- Overrides:
groupByin classAbstractBag<T>
-
groupByEach
public <V> ImmutableBagMultimap<V,T> groupByEach(Function<? super T,? extends Iterable<V>> function)Description copied from interface:RichIterableSimilar toRichIterable.groupBy(Function), except the result of evaluating function will return a collection of keys for each value.- Specified by:
groupByEachin interfaceBag<T>- Specified by:
groupByEachin interfaceImmutableBag<T>- Specified by:
groupByEachin interfaceImmutableBagIterable<T>- Specified by:
groupByEachin interfaceImmutableCollection<T>- Specified by:
groupByEachin interfaceRichIterable<T>- Specified by:
groupByEachin interfaceUnsortedBag<T>
-
groupByEach
public <V, R extends MutableMultimap<V, T>> R groupByEach(Function<? super T,? extends Iterable<V>> function, R target)Description copied from interface:RichIterableSame asRichIterable.groupByEach(Function), except that the results are gathered into the specifiedtargetmultimap.- Specified by:
groupByEachin interfaceRichIterable<T>- Overrides:
groupByEachin classAbstractBag<T>
-
groupByUniqueKey
Description copied from interface:RichIterableFor each element of the iterable, the function is evaluated and he results of these evaluations are collected into a new map, where the transformed value is the key. The generated keys must each be unique, or else an exception is thrown.- Specified by:
groupByUniqueKeyin interfaceImmutableCollection<T>- Specified by:
groupByUniqueKeyin interfaceRichIterable<T>- Overrides:
groupByUniqueKeyin classAbstractImmutableBag<T>- See Also:
RichIterable.groupBy(Function)
-
isEmpty
public boolean isEmpty()Description copied from interface:RichIterableReturns true if this iterable has zero items.- Specified by:
isEmptyin interfaceCollection<T>- Specified by:
isEmptyin interfaceRichIterable<T>- Overrides:
isEmptyin classAbstractRichIterable<T>
-
notEmpty
public boolean notEmpty()Description copied from interface:RichIterableThe English equivalent of !this.isEmpty()- Specified by:
notEmptyin interfaceRichIterable<T>
-
getFirst
Description copied from interface:RichIterableReturns the first element of an iterable. In the case of a List it is the element at the first index. In the case of any other Collection, it is the first element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the first element could be any element from the Set.
- Specified by:
getFirstin interfaceRichIterable<T>
-
getLast
Description copied from interface:RichIterableReturns the last element of an iterable. In the case of a List it is the element at the last index. In the case of any other Collection, it is the last element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the last element could be any element from the Set.
- Specified by:
getLastin interfaceRichIterable<T>
-
getOnly
Description copied from interface:RichIterableReturns the element if the iterable has exactly one element. Otherwise, throwIllegalStateException.- Specified by:
getOnlyin interfaceRichIterable<T>- Returns:
- an element of an iterable.
-
min
Description copied from interface:RichIterableReturns the minimum element out of this container based on the comparator.- Specified by:
minin interfaceRichIterable<T>- Overrides:
minin classAbstractRichIterable<T>
-
max
Description copied from interface:RichIterableReturns the maximum element out of this container based on the comparator.- Specified by:
maxin interfaceRichIterable<T>- Overrides:
maxin classAbstractRichIterable<T>
-
min
Description copied from interface:RichIterableReturns the minimum element out of this container based on the natural order.- Specified by:
minin interfaceRichIterable<T>- Overrides:
minin classAbstractRichIterable<T>
-
max
Description copied from interface:RichIterableReturns the maximum element out of this container based on the natural order.- Specified by:
maxin interfaceRichIterable<T>- Overrides:
maxin classAbstractRichIterable<T>
-
minBy
Description copied from interface:RichIterableReturns the minimum elements out of this container based on the natural order of the attribute returned by Function.- Specified by:
minByin interfaceRichIterable<T>- Overrides:
minByin classAbstractRichIterable<T>
-
maxBy
Description copied from interface:RichIterableReturns the maximum elements out of this container based on the natural order of the attribute returned by Function.- Specified by:
maxByin interfaceRichIterable<T>- Overrides:
maxByin classAbstractRichIterable<T>
-
contains
Description copied from interface:RichIterableReturns true if the iterable has an element which responds true to element.equals(object).- Specified by:
containsin interfaceCollection<T>- Specified by:
containsin interfaceRichIterable<T>- Overrides:
containsin classAbstractRichIterable<T>
-
containsAllIterable
Description copied from interface:RichIterableReturns true if all elements in source are contained in this collection.- Specified by:
containsAllIterablein interfaceRichIterable<T>- Overrides:
containsAllIterablein classAbstractRichIterable<T>
-
containsAllArguments
Description copied from interface:RichIterableReturns true if all elements in the specified var arg array are contained in this collection.- Specified by:
containsAllArgumentsin interfaceRichIterable<T>- Overrides:
containsAllArgumentsin classAbstractRichIterable<T>
-
toMap
public <K, V> MutableMap<K,V> toMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)Description copied from interface:RichIterableConverts the collection to a MutableMap implementation using the specified key and value functions.- Specified by:
toMapin interfaceRichIterable<T>- Overrides:
toMapin classAbstractRichIterable<T>
-
toMap
public <K, V, R extends Map<K, V>> R toMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction, R target)Description copied from interface:RichIterableSame asRichIterable.toMap(Function, Function), except that the results are gathered into the specifiedtargetmap.- Specified by:
toMapin interfaceRichIterable<T>
-
each
Description copied from interface:RichIterableThe procedure is executed for each element in the iterable.Example using a Java 8 lambda expression:
people.each(person -> LOGGER.info(person.getName()));
Example using an anonymous inner class:
people.each(new Procedure<Person>() { public void value(Person person) { LOGGER.info(person.getName()); } });This method is a variant ofInternalIterable.forEach(Procedure)that has a signature conflict withIterable.forEach(java.util.function.Consumer).- Specified by:
eachin interfaceRichIterable<T>- See Also:
InternalIterable.forEach(Procedure),Iterable.forEach(java.util.function.Consumer)
-
forEachWithIndex
Description copied from interface:InternalIterableIterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });- Specified by:
forEachWithIndexin interfaceInternalIterable<T>- Overrides:
forEachWithIndexin classAbstractRichIterable<T>
-
selectInstancesOf
Description copied from interface:RichIterableReturns all elements of the source collection that are instances of the Classclazz.RichIterable<Integer> integers = List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);- Specified by:
selectInstancesOfin interfaceBag<T>- Specified by:
selectInstancesOfin interfaceImmutableBag<T>- Specified by:
selectInstancesOfin interfaceImmutableBagIterable<T>- Specified by:
selectInstancesOfin interfaceImmutableCollection<T>- Specified by:
selectInstancesOfin interfaceRichIterable<T>- Specified by:
selectInstancesOfin interfaceUnsortedBag<T>
-
selectByOccurrences
Description copied from interface:BagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceBag<T>- Specified by:
selectByOccurrencesin interfaceImmutableBag<T>- Specified by:
selectByOccurrencesin interfaceImmutableBagIterable<T>- Specified by:
selectByOccurrencesin interfaceUnsortedBag<T>
-
forEachWithOccurrences
Description copied from interface:BagFor each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrencesin interfaceBag<T>
-
sizeDistinct
public int sizeDistinct()Description copied from interface:BagThe size of the Bag when counting only distinct elements.- Specified by:
sizeDistinctin interfaceBag<T>
-
occurrencesOf
Description copied from interface:BagThe occurrences of a distinct item in the bag.- Specified by:
occurrencesOfin interfaceBag<T>
-
toList
Description copied from interface:RichIterableConverts the collection to a MutableList implementation.- Specified by:
toListin interfaceRichIterable<T>- Overrides:
toListin classAbstractBag<T>
-
toSortedList
Description copied from interface:RichIterableConverts the collection to a MutableList implementation and sorts it using the natural order of the elements.- Specified by:
toSortedListin interfaceRichIterable<T>
-
toSortedList
Description copied from interface:RichIterableConverts the collection to a MutableList implementation and sorts it using the specified comparator.- Specified by:
toSortedListin interfaceRichIterable<T>- Overrides:
toSortedListin classAbstractBag<T>
-
toSortedSet
Description copied from interface:RichIterableConverts the collection to a MutableSortedSet implementation and sorts it using the natural order of the elements.- Specified by:
toSortedSetin interfaceRichIterable<T>- Overrides:
toSortedSetin classAbstractBag<T>
-
toSortedSet
Description copied from interface:RichIterableConverts the collection to a MutableSortedSet implementation and sorts it using the specified comparator.- Specified by:
toSortedSetin interfaceRichIterable<T>- Overrides:
toSortedSetin classAbstractBag<T>
-
toSortedMap
public <K, V> MutableSortedMap<K,V> toSortedMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)Description copied from interface:RichIterableConverts the collection to a MutableSortedMap implementation using the specified key and value functions sorted by the key elements' natural ordering.- Specified by:
toSortedMapin interfaceRichIterable<T>- Overrides:
toSortedMapin classAbstractRichIterable<T>
-
toSortedMap
public <K, V> MutableSortedMap<K,V> toSortedMap(Comparator<? super K> comparator, Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)Description copied from interface:RichIterableConverts the collection to a MutableSortedMap implementation using the specified key and value functions sorted by the given comparator.- Specified by:
toSortedMapin interfaceRichIterable<T>- Overrides:
toSortedMapin classAbstractRichIterable<T>
-
toSortedMapBy
public <KK extends Comparable<? super KK>, K, V> MutableSortedMap<K,V> toSortedMapBy(Function<? super K,KK> sortBy, Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)Description copied from interface:RichIterableConverts the collection to a MutableSortedMap implementation using the specified key and value functions and sorts it based on the natural order of the attribute returned bysortByfunction.- Specified by:
toSortedMapByin interfaceRichIterable<T>- Overrides:
toSortedMapByin classAbstractRichIterable<T>
-
select
Description copied from interface:RichIterableReturns all elements of the source collection that return true when evaluating the predicate. This method is also commonly called filter.Example using a Java 8 lambda expression:
RichIterable<Person> selected = people.select(person -> person.getAddress().getCity().equals("London"));Example using an anonymous inner class:
RichIterable<Person> selected = people.select(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getCity().equals("London"); } });- Specified by:
selectin interfaceBag<T>- Specified by:
selectin interfaceImmutableBag<T>- Specified by:
selectin interfaceImmutableBagIterable<T>- Specified by:
selectin interfaceImmutableCollection<T>- Specified by:
selectin interfaceRichIterable<T>- Specified by:
selectin interfaceUnsortedBag<T>
-
select
Description copied from interface:RichIterableSame as the select method with one parameter but uses the specified target collection for the results.Example using a Java 8 lambda expression:
MutableList<Person> selected = people.select(person -> person.person.getLastName().equals("Smith"), Lists.mutable.empty());Example using an anonymous inner class:
MutableList<Person> selected = people.select(new Predicate<Person>() { public boolean accept(Person person) { return person.person.getLastName().equals("Smith"); } }, Lists.mutable.empty());- Specified by:
selectin interfaceRichIterable<T>- Overrides:
selectin classAbstractBag<T>- Parameters:
predicate- aPredicateto use as the select criteriatarget- the Collection to append to for all elements in thisRichIterablethat meet select criteriapredicate- Returns:
target, which contains appended elements as a result of the select criteria- See Also:
RichIterable.select(Predicate)
-
reject
Description copied from interface:RichIterableReturns all elements of the source collection that return false when evaluating of the predicate. This method is also sometimes called filterNot and is the equivalent of calling iterable.select(Predicates.not(predicate)).Example using a Java 8 lambda expression:
RichIterable<Person> rejected = people.reject(person -> person.person.getLastName().equals("Smith"));Example using an anonymous inner class:
RichIterable<Person> rejected = people.reject(new Predicate<Person>() { public boolean accept(Person person) { return person.person.getLastName().equals("Smith"); } });- Specified by:
rejectin interfaceBag<T>- Specified by:
rejectin interfaceImmutableBag<T>- Specified by:
rejectin interfaceImmutableBagIterable<T>- Specified by:
rejectin interfaceImmutableCollection<T>- Specified by:
rejectin interfaceRichIterable<T>- Specified by:
rejectin interfaceUnsortedBag<T>- Parameters:
predicate- aPredicateto use as the reject criteria- Returns:
- a RichIterable that contains elements that cause
Predicate.accept(Object)method to evaluate to false
-
reject
Description copied from interface:RichIterableSame as the reject method with one parameter but uses the specified target collection for the results.Example using a Java 8 lambda expression:
MutableList<Person> rejected = people.reject(person -> person.person.getLastName().equals("Smith"), Lists.mutable.empty());Example using an anonymous inner class:
MutableList<Person> rejected = people.reject(new Predicate<Person>() { public boolean accept(Person person) { return person.person.getLastName().equals("Smith"); } }, Lists.mutable.empty());- Specified by:
rejectin interfaceRichIterable<T>- Overrides:
rejectin classAbstractBag<T>- Parameters:
predicate- aPredicateto use as the reject criteriatarget- the Collection to append to for all elements in thisRichIterablethat causePredicate#accept(Object)method to evaluate to false- Returns:
target, which contains appended elements as a result of the reject criteria
-
partition
Description copied from interface:RichIterableFilters a collection into a PartitionedIterable based on the evaluation of the predicate.Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partition(person -> person.getAddress().getState().getName().equals("New York"));Example using an anonymous inner class:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partition(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getState().getName().equals("New York"); } });- Specified by:
partitionin interfaceBag<T>- Specified by:
partitionin interfaceImmutableBag<T>- Specified by:
partitionin interfaceImmutableBagIterable<T>- Specified by:
partitionin interfaceImmutableCollection<T>- Specified by:
partitionin interfaceRichIterable<T>- Specified by:
partitionin interfaceUnsortedBag<T>- Overrides:
partitionin classAbstractImmutableBag<T>
-
collect
Description copied from interface:RichIterableReturns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.Example using a Java 8 lambda expression:
RichIterable<String> names = people.collect(person -> person.getFirstName() + " " + person.getLastName());Example using an anonymous inner class:
RichIterable<String> names = people.collect(new Function<Person, String>() { public String valueOf(Person person) { return person.getFirstName() + " " + person.getLastName(); } });- Specified by:
collectin interfaceImmutableBag<T>- Specified by:
collectin interfaceImmutableCollection<T>- Specified by:
collectin interfaceRichIterable<T>- Specified by:
collectin interfaceUnsortedBag<T>
-
collect
public <V, R extends Collection<V>> R collect(Function<? super T,? extends V> function, R target)Description copied from interface:RichIterableSame asRichIterable.collect(Function), except that the results are gathered into the specifiedtargetcollection.Example using a Java 8 lambda expression:
MutableList<String> names = people.collect(person -> person.getFirstName() + " " + person.getLastName(), Lists.mutable.empty());Example using an anonymous inner class:
MutableList<String> names = people.collect(new Function<Person, String>() { public String valueOf(Person person) { return person.getFirstName() + " " + person.getLastName(); } }, Lists.mutable.empty());- Specified by:
collectin interfaceRichIterable<T>- Overrides:
collectin classAbstractBag<T>- Parameters:
function- aFunctionto use as the collect transformation functiontarget- the Collection to append to for all elements in thisRichIterablethat meet select criteriafunction- Returns:
target, which contains appended elements as a result of the collect transformation- See Also:
RichIterable.collect(Function)
-
collectIf
public <V> ImmutableBag<V> collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)Description copied from interface:RichIterableReturns 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. This is the the optimized equivalent of calling iterable.select(predicate).collect(function).Example using a Java 8 lambda and method reference:
RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(e -> e != null, Object::toString);
Example using Predicates factory:
RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(Predicates.notNull(), Functions.getToString());
- Specified by:
collectIfin interfaceImmutableBag<T>- Specified by:
collectIfin interfaceImmutableCollection<T>- Specified by:
collectIfin interfaceRichIterable<T>- Specified by:
collectIfin interfaceUnsortedBag<T>
-
collectIf
public <V, R extends Collection<V>> R collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function, R target)Description copied from interface:RichIterableSame as the collectIf method with two parameters but uses the specified target collection for the results.- Specified by:
collectIfin interfaceRichIterable<T>- Overrides:
collectIfin classAbstractBag<T>- Parameters:
predicate- aPredicateto use as the select criteriafunction- aFunctionto use as the collect transformation functiontarget- the Collection to append to for all elements in thisRichIterablethat meet the collect criteriapredicate- Returns:
targetCollection, which contains appended elements as a result of the collect criteria and transformation- See Also:
RichIterable.collectIf(Predicate, Function)
-
flatCollect
Description copied from interface:RichIterableflatCollectis a special case ofRichIterable.collect(Function). Withcollect, when theFunctionreturns a collection, the result is a collection of collections.flatCollectoutputs a single "flattened" collection instead. This method is commonly called flatMap.Consider the following example where we have a
Personclass, and eachPersonhas a list ofAddressobjects. Take the followingFunction:Function<Person, List<Address>> addressFunction = Person::getAddresses; RichIterable<Person> people = ...;
Usingcollectreturns a collection of collections of addresses.RichIterable<List<Address>> addresses = people.collect(addressFunction);
UsingflatCollectreturns a single flattened list of addresses.RichIterable<Address> addresses = people.flatCollect(addressFunction);
- Specified by:
flatCollectin interfaceImmutableBag<T>- Specified by:
flatCollectin interfaceImmutableCollection<T>- Specified by:
flatCollectin interfaceRichIterable<T>- Specified by:
flatCollectin interfaceUnsortedBag<T>- Parameters:
function- TheFunctionto apply- Returns:
- a new flattened collection produced by applying the given
function
-
flatCollect
public <V, R extends Collection<V>> R flatCollect(Function<? super T,? extends Iterable<V>> function, R target)Description copied from interface:RichIterableSame as flatCollect, only the results are collected into the target collection.- Specified by:
flatCollectin interfaceRichIterable<T>- Overrides:
flatCollectin classAbstractBag<T>- Parameters:
function- TheFunctionto applytarget- The collection into which results should be added.- Returns:
target, which will contain a flattened collection of results produced by applying the givenfunction- See Also:
RichIterable.flatCollect(Function)
-
detect
Description copied from interface:RichIterableReturns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true. This method is commonly called find.Example using a Java 8 lambda expression:
Person person = people.detect(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));Example using an anonymous inner class:
Person person = people.detect(new Predicate<Person>() { public boolean accept(Person person) { return person.getFirstName().equals("John") && person.getLastName().equals("Smith"); } });- Specified by:
detectin interfaceRichIterable<T>- Overrides:
detectin classAbstractRichIterable<T>
-
detectWith
Description copied from interface:RichIterableReturns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true.Example using a Java 8 lambda expression:
Person person = people.detectWith((person, fullName) -> person.getFullName().equals(fullName), "John Smith");Example using an anonymous inner class:
Person person = people.detectWith(new Predicate2<Person, String>() { public boolean accept(Person person, String fullName) { return person.getFullName().equals(fullName); } }, "John Smith");- Specified by:
detectWithin interfaceRichIterable<T>- Overrides:
detectWithin classAbstractRichIterable<T>
-
detectOptional
Description copied from interface:RichIterableReturns the first element of the iterable for which the predicate evaluates to true as an Optional. This method is commonly called find.Example using a Java 8 lambda expression:
Person person = people.detectOptional(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));- Specified by:
detectOptionalin interfaceRichIterable<T>- Overrides:
detectOptionalin classAbstractRichIterable<T>
-
detectWithOptional
Description copied from interface:RichIterableReturns the first element that evaluates to true for the specified predicate2 and parameter as an Optional.Example using a Java 8 lambda expression:
Optional<Person> person = people.detectWithOptional((person, fullName) -> person.getFullName().equals(fullName), "John Smith");- Specified by:
detectWithOptionalin interfaceRichIterable<T>- Overrides:
detectWithOptionalin classAbstractRichIterable<T>
-
detectIfNone
Description copied from interface:RichIterableReturns the first element of the iterable for which the predicate evaluates to true. If no element matches the predicate, then returns the value of applying the specified function.- Specified by:
detectIfNonein interfaceRichIterable<T>
-
count
Description copied from interface:RichIterableReturn the total number of elements that answer true to the specified predicate.Example using a Java 8 lambda expression:
int count = people.count(person -> person.getAddress().getState().getName().equals("New York"));Example using an anonymous inner class:
int count = people.count(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getState().getName().equals("New York"); } });- Specified by:
countin interfaceRichIterable<T>- Overrides:
countin classAbstractBag<T>
-
anySatisfy
Description copied from interface:RichIterableReturns true if the predicate evaluates to true for any element of the iterable. Returns false if the iterable is empty, or if no element returned true when evaluating the predicate.- Specified by:
anySatisfyin interfaceRichIterable<T>- Overrides:
anySatisfyin classAbstractRichIterable<T>
-
anySatisfyWith
Description copied from interface:RichIterableReturns true if the predicate evaluates to true for any element of the collection, or return false. Returns false if the collection is empty.- Specified by:
anySatisfyWithin interfaceRichIterable<T>- Overrides:
anySatisfyWithin classAbstractRichIterable<T>
-
allSatisfy
Description copied from interface:RichIterableReturns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. Otherwise, returns false.- Specified by:
allSatisfyin interfaceRichIterable<T>- Overrides:
allSatisfyin classAbstractRichIterable<T>
-
allSatisfyWith
Description copied from interface:RichIterableReturns true if the predicate evaluates to true for every element of the collection, or returns false.- Specified by:
allSatisfyWithin interfaceRichIterable<T>- Overrides:
allSatisfyWithin classAbstractRichIterable<T>
-
noneSatisfy
Description copied from interface:RichIterableReturns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. Otherwise, returns false.- Specified by:
noneSatisfyin interfaceRichIterable<T>- Overrides:
noneSatisfyin classAbstractRichIterable<T>
-
noneSatisfyWith
Description copied from interface:RichIterableReturns true if the predicate evaluates to false for every element of the collection, or return false. Returns true if the collection is empty.- Specified by:
noneSatisfyWithin interfaceRichIterable<T>- Overrides:
noneSatisfyWithin classAbstractRichIterable<T>
-
injectInto
public <IV> IV injectInto(IV injectedValue, Function2<? super IV,? super T,? extends IV> function)Description copied from interface:RichIterableReturns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter. This method is commonly called fold or sometimes reduce.- Specified by:
injectIntoin interfaceRichIterable<T>- Overrides:
injectIntoin classAbstractBag<T>
-
injectInto
Description copied from interface:RichIterableReturns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.- Specified by:
injectIntoin interfaceRichIterable<T>- Overrides:
injectIntoin classAbstractBag<T>
-
injectInto
Description copied from interface:RichIterableReturns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.- Specified by:
injectIntoin interfaceRichIterable<T>- Overrides:
injectIntoin classAbstractBag<T>
-
injectInto
Description copied from interface:RichIterableReturns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.- Specified by:
injectIntoin interfaceRichIterable<T>- Overrides:
injectIntoin classAbstractBag<T>
-
injectInto
Description copied from interface:RichIterableReturns the final float result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.- Specified by:
injectIntoin interfaceRichIterable<T>- Overrides:
injectIntoin classAbstractBag<T>
-
equals
Description copied from interface:BagTwo bagsb1andb2are equal ifm1.toMapOfItemToCount().equals(m2.toMapOfItemToCount()).- Specified by:
equalsin interfaceBag<T>- Specified by:
equalsin interfaceCollection<T>- Overrides:
equalsin classObject- See Also:
Map.equals(Object)
-
hashCode
public int hashCode()Description copied from interface:BagReturns the hash code for this Bag, defined as this.Bag.toMapOfItemToCount().hashCode().- Specified by:
hashCodein interfaceBag<T>- Specified by:
hashCodein interfaceCollection<T>- Overrides:
hashCodein classObject- See Also:
Map.hashCode()
-
toMapOfItemToCount
Description copied from interface:BagConverts the Bag to a Map of the Item type to its count as an Integer.- Specified by:
toMapOfItemToCountin interfaceBag<T>- Specified by:
toMapOfItemToCountin interfaceImmutableBagIterable<T>
-
toSet
Description copied from interface:RichIterableConverts the collection to a MutableSet implementation.- Specified by:
toSetin interfaceRichIterable<T>- Overrides:
toSetin classAbstractBag<T>
-
toBag
Description copied from interface:RichIterableConverts the collection to the default MutableBag implementation.- Specified by:
toBagin interfaceRichIterable<T>- Overrides:
toBagin classAbstractBag<T>
-
toSortedBag
Description copied from interface:RichIterableConverts the collection to a MutableSortedBag implementation and sorts it using the natural order of the elements.- Specified by:
toSortedBagin interfaceRichIterable<T>- Overrides:
toSortedBagin classAbstractBag<T>
-
toSortedBag
Description copied from interface:RichIterableConverts the collection to the MutableSortedBag implementation and sorts it using the specified comparator.- Specified by:
toSortedBagin interfaceRichIterable<T>- Overrides:
toSortedBagin classAbstractBag<T>
-
toSortedBagBy
public <V extends Comparable<? super V>> MutableSortedBag<T> toSortedBagBy(Function<? super T,? extends V> function)Description copied from interface:RichIterableConverts the collection to a MutableSortedBag implementation and sorts it based on the natural order of the attribute returned byfunction.- Specified by:
toSortedBagByin interfaceRichIterable<T>- Overrides:
toSortedBagByin classAbstractRichIterable<T>
-
asLazy
Description copied from interface:RichIterableReturns a lazy (deferred) iterable, most likely implemented by calling LazyIterate.adapt(this).- Specified by:
asLazyin interfaceRichIterable<T>- Overrides:
asLazyin classAbstractRichIterable<T>
-
toArray
Description copied from interface:RichIterableConverts this iterable to an array.- Specified by:
toArrayin interfaceCollection<T>- Specified by:
toArrayin interfaceRichIterable<T>- Overrides:
toArrayin classAbstractRichIterable<T>- See Also:
Collection.toArray()
-
toArray
public <T> T[] toArray(T[] a)Description copied from interface:RichIterableConverts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.- Specified by:
toArrayin interfaceCollection<T>- Specified by:
toArrayin interfaceRichIterable<T>- Overrides:
toArrayin classAbstractRichIterable<T>- See Also:
Collection.toArray(Object[])
-
toString
Description copied from class:AbstractRichIterableReturns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.Assert.assertEquals("[]", Lists.mutable.empty().toString()); Assert.assertEquals("[1]", Lists.mutable.with(1).toString()); Assert.assertEquals("[1, 2, 3]", Lists.mutable.with(1, 2, 3).toString());- Specified by:
toStringin interfaceRichIterable<T>- Overrides:
toStringin classAbstractRichIterable<T>- Returns:
- a string representation of this collection.
- See Also:
AbstractCollection.toString()
-
makeString
Description copied from interface:RichIterableReturns a string representation of this collection by delegating toRichIterable.makeString(String)and defaulting the separator parameter to the characters", "(comma and space).- Specified by:
makeStringin interfaceRichIterable<T>- Returns:
- a string representation of this collection.
-
makeString
Description copied from interface:RichIterableReturns a string representation of this collection by delegating toRichIterable.makeString(String, String, String)and defaulting the start and end parameters to""(the empty String).- Specified by:
makeStringin interfaceRichIterable<T>- Returns:
- a string representation of this collection.
-
makeString
Description copied from interface:RichIterableReturns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.- Specified by:
makeStringin interfaceRichIterable<T>- Returns:
- a string representation of this collection.
-
appendString
Description copied from interface:RichIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byRichIterable.makeString().- Specified by:
appendStringin interfaceRichIterable<T>
-
appendString
Description copied from interface:RichIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byRichIterable.makeString(String).- Specified by:
appendStringin interfaceRichIterable<T>- Overrides:
appendStringin classAbstractRichIterable<T>
-
appendString
Description copied from interface:RichIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byRichIterable.makeString(String, String, String).- Specified by:
appendStringin interfaceRichIterable<T>- Overrides:
appendStringin classAbstractRichIterable<T>
-
zip
Deprecated.in 6.0. UseOrderedIterable.zip(Iterable)instead.Description copied from interface:RichIterableReturns aRichIterableformed from thisRichIterableand anotherRichIterableby combining corresponding elements in pairs. If one of the twoRichIterables is longer than the other, its remaining elements are ignored.- Specified by:
zipin interfaceImmutableBag<T>- Specified by:
zipin interfaceImmutableCollection<T>- Specified by:
zipin interfaceRichIterable<T>- Specified by:
zipin interfaceUnsortedBag<T>- Type Parameters:
S- the type of the second half of the returned pairs- Parameters:
that- TheRichIterableproviding the second half of each result pair- Returns:
- A new
RichIterablecontaining pairs consisting of corresponding elements of thisRichIterableand that. The length of the returnedRichIterableis the minimum of the lengths of thisRichIterableand that.
-
zip
Description copied from interface:RichIterableSame asRichIterable.zip(Iterable)but usestargetfor output.- Specified by:
zipin interfaceRichIterable<T>- Overrides:
zipin classAbstractRichIterable<T>
-
zipWithIndex
Deprecated.in 6.0. UseOrderedIterable.zipWithIndex()instead.Description copied from interface:RichIterableZips thisRichIterablewith its indices.- Specified by:
zipWithIndexin interfaceBag<T>- Specified by:
zipWithIndexin interfaceImmutableBag<T>- Specified by:
zipWithIndexin interfaceImmutableBagIterable<T>- Specified by:
zipWithIndexin interfaceImmutableCollection<T>- Specified by:
zipWithIndexin interfaceRichIterable<T>- Specified by:
zipWithIndexin interfaceUnsortedBag<T>- Returns:
- A new
RichIterablecontaining pairs consisting of all elements of thisRichIterablepaired with their index. Indices start at 0. - See Also:
RichIterable.zip(Iterable)
-
zipWithIndex
Description copied from interface:RichIterableSame asRichIterable.zipWithIndex()but usestargetfor output.- Specified by:
zipWithIndexin interfaceRichIterable<T>- Overrides:
zipWithIndexin classAbstractRichIterable<T>
-
iterator
-