diff --git a/eclipse-collections-api/src/main/java/org/eclipse/collections/api/RichIterable.java b/eclipse-collections-api/src/main/java/org/eclipse/collections/api/RichIterable.java index 3f8571d7d5..37a31006d0 100644 --- a/eclipse-collections-api/src/main/java/org/eclipse/collections/api/RichIterable.java +++ b/eclipse-collections-api/src/main/java/org/eclipse/collections/api/RichIterable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Goldman Sachs and others. + * Copyright (c) 2023 Goldman Sachs and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v. 1.0 which accompany this distribution. @@ -89,10 +89,11 @@ import org.eclipse.collections.api.tuple.Pair; /** - * RichIterable is an interface which extends the InternalIterable interface with several internal iterator methods, from - * the Smalltalk Collection protocol. These include select, reject, detect, collect, injectInto, anySatisfy, - * allSatisfy. The API also includes converter methods to convert a RichIterable to a List (toList), to a sorted - * List (toSortedList), to a Set (toSet), and to a Map (toMap). + * RichIterable is a read-only interface which extends the InternalIterable interface and adds many internal iterator methods. + * The basic methods were inspired by the Smalltalk Collection protocol. These methods include select, reject, detect, + * collect, injectInto, anySatisfy, allSatisfy. The API also includes converter methods to convert a RichIterable to + * other mutable and immutable collection types. The converter methods all have a prefix of "to" (e.g. toList, toSet, + * toBag, toMap, etc). * * @since 1.0 */ @@ -322,18 +323,6 @@ else if (inside.size() > 32 && !(inside instanceof SetIterable)) * RichIterable<Person> tapped = * people.tap(person -> LOGGER.info(person.getName())); * - *
- * Example using an anonymous inner class: - *
- * RichIterable<Person> tapped = - * people.tap(new Procedure<Person>() - * { - * public void value(Person person) - * { - * LOGGER.info(person.getName()); - * } - * }); - ** * @see #each(Procedure) * @see #forEach(Procedure) @@ -348,17 +337,6 @@ else if (inside.size() > 32 && !(inside instanceof SetIterable)) *
* 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 of {@link InternalIterable#forEach(Procedure)} * that has a signature conflict with {@link Iterable#forEach(java.util.function.Consumer)}. * @@ -378,18 +356,6 @@ else if (inside.size() > 32 && !(inside instanceof SetIterable)) * 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"); - * } - * }); - ** * @since 1.0 */ @@ -404,18 +370,6 @@ else if (inside.size() > 32 && !(inside instanceof SetIterable)) * 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()); - *- *
* * @param predicate a {@link Predicate} to use as the select criteria * @param target the Collection to append to for all elements in this {@code RichIterable} that meet select criteria {@code predicate} @@ -435,18 +389,6 @@ else if (inside.size() > 32 && !(inside instanceof SetIterable)) * RichIterable<Person> selected = * people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18)); * - *
- * Example using an anonymous inner class: - *
- * RichIterable<Person> selected = - * people.selectWith(new Predicate2<Person, Integer>() - * { - * public boolean accept(Person person, Integer age) - * { - * return person.getAge()>= age; - * } - * }, Integer.valueOf(18)); - ** * @param predicate a {@link Predicate2} to use as the select criteria * @param parameter a parameter to pass in for evaluation of the second argument {@code P} in {@code predicate} @@ -465,18 +407,6 @@ else if (inside.size() > 32 && !(inside instanceof SetIterable)) * MutableList<Person> selected = * people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18), Lists.mutable.empty()); * - *
- * Example using an anonymous inner class: - *
- * MutableList<Person> selected = - * people.selectWith(new Predicate2<Person, Integer>() - * { - * public boolean accept(Person person, Integer age) - * { - * return person.getAge()>= age; - * } - * }, Integer.valueOf(18), Lists.mutable.empty()); - ** * @param predicate a {@link Predicate2} to use as the select criteria * @param parameter a parameter to pass in for evaluation of the second argument {@code P} in {@code predicate} @@ -500,18 +430,6 @@
> R selectWith( * 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"); - * } - * }); - ** * @param predicate a {@link Predicate} to use as the reject criteria * @return a RichIterable that contains elements that cause {@link Predicate#accept(Object)} method to evaluate to false @@ -529,18 +447,6 @@
> R selectWith( * RichIterable<Person> rejected = * people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18)); * - *
- * Example using an anonymous inner class: - *
- * MutableList<Person> rejected = - * people.rejectWith(new Predicate2<Person, Integer>() - * { - * public boolean accept(Person person, Integer age) - * { - * return person.getAge() < age; - * } - * }, Integer.valueOf(18)); - ** * @param predicate a {@link Predicate2} to use as the select criteria * @param parameter a parameter to pass in for evaluation of the second argument {@code P} in {@code predicate} @@ -557,18 +463,6 @@
> R selectWith( * 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()); - ** * @param predicate a {@link Predicate} to use as the reject criteria * @param target the Collection to append to for all elements in this {@code RichIterable} that cause {@code Predicate#accept(Object)} method to evaluate to false @@ -587,18 +481,6 @@
> R selectWith( * MutableList<Person> rejected = * people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18), Lists.mutable.empty()); * - *
- * Example using an anonymous inner class: - *
- * MutableList<Person> rejected = - * people.rejectWith(new Predicate2<Person, Integer>() - * { - * public boolean accept(Person person, Integer age) - * { - * return person.getAge() < age; - * } - * }, Integer.valueOf(18), Lists.mutable.empty()); - ** * @param predicate a {@link Predicate2} to use as the reject criteria * @param parameter a parameter to pass in for evaluation of the second argument {@code P} in {@code predicate} @@ -621,18 +503,6 @@
> R rejectWith( * 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"); - * } - * }); - ** * @since 1.0. */ @@ -646,18 +516,6 @@
> R rejectWith( * PartitionIterable<Person> newYorkersAndNonNewYorkers = * people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York"); * - *
- * Example using an anonymous inner class: - *
- * PartitionIterable<Person> newYorkersAndNonNewYorkers = - * people.partitionWith(new Predicate2<Person, String>() - * { - * public boolean accept(Person person, String state) - * { - * return person.getAddress().getState().getName().equals(state); - * } - * }, "New York"); - ** * @since 5.0. */ @@ -684,18 +542,6 @@
> R rejectWith( * 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(); - * } - * }); - ** * @since 1.0 */ @@ -710,18 +556,6 @@
> R rejectWith( * 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()); - ** * @param function a {@link Function} to use as the collect transformation function * @param target the Collection to append to for all elements in this {@code RichIterable} that meet select criteria {@code function} @@ -740,18 +574,6 @@
> R rejectWith( * BooleanIterable licenses = * people.collectBoolean(person -> person.hasDrivingLicense()); * - *
- * Example using an anonymous inner class: - *
- * BooleanIterable licenses = - * people.collectBoolean(new BooleanFunction<Person>() - * { - * public boolean booleanValueOf(Person person) - * { - * return person.hasDrivingLicense(); - * } - * }); - ** * @since 4.0 */ @@ -766,18 +588,6 @@
> R rejectWith( * BooleanArrayList licenses = * people.collectBoolean(person -> person.hasDrivingLicense(), new BooleanArrayList()); * - *
- * Example using an anonymous inner class: - *
- * BooleanArrayList licenses = - * people.collectBoolean(new BooleanFunction<Person>() - * { - * public boolean booleanValueOf(Person person) - * { - * return person.hasDrivingLicense(); - * } - * }, new BooleanArrayList()); - ** * @param booleanFunction a {@link BooleanFunction} to use as the collect transformation function * @param target the MutableBooleanCollection to append to for all elements in this {@code RichIterable} @@ -799,18 +609,6 @@ default
- * Example using an anonymous inner class: - *
- * ByteIterable bytes = - * people.collectByte(new ByteFunction<Person>() - * { - * public byte byteValueOf(Person person) - * { - * return person.getCode(); - * } - * }); - ** * @since 4.0 */ @@ -825,18 +623,6 @@ default
- * Example using an anonymous inner class: - *
- * ByteArrayList bytes = - * people.collectByte(new ByteFunction<Person>() - * { - * public byte byteValueOf(Person person) - * { - * return person.getCode(); - * } - * }, new ByteArrayList()); - ** * @param byteFunction a {@link ByteFunction} to use as the collect transformation function * @param target the MutableByteCollection to append to for all elements in this {@code RichIterable} @@ -858,18 +644,6 @@ default
- * Example using an anonymous inner class: - *
- * CharIterable chars = - * people.collectChar(new CharFunction<Person>() - * { - * public char charValueOf(Person person) - * { - * return person.getMiddleInitial(); - * } - * }); - ** * @since 4.0 */ @@ -884,18 +658,6 @@ default
- * Example using an anonymous inner class: - *
- * CharArrayList chars = - * people.collectChar(new CharFunction<Person>() - * { - * public char charValueOf(Person person) - * { - * return person.getMiddleInitial(); - * } - * }, new CharArrayList()); - ** * @param charFunction a {@link CharFunction} to use as the collect transformation function * @param target the MutableCharCollection to append to for all elements in this {@code RichIterable} @@ -917,18 +679,6 @@ default
- * Example using an anonymous inner class: - *
- * DoubleIterable doubles = - * people.collectDouble(new DoubleFunction<Person>() - * { - * public double doubleValueOf(Person person) - * { - * return person.getMilesFromNorthPole(); - * } - * }); - ** * @since 4.0 */ @@ -943,18 +693,6 @@ default
- * Example using an anonymous inner class: - *
- * DoubleArrayList doubles = - * people.collectDouble(new DoubleFunction<Person>() - * { - * public double doubleValueOf(Person person) - * { - * return person.getMilesFromNorthPole(); - * } - * }, new DoubleArrayList()); - ** * @param doubleFunction a {@link DoubleFunction} to use as the collect transformation function * @param target the MutableDoubleCollection to append to for all elements in this {@code RichIterable} @@ -976,18 +714,6 @@ default
- * Example using an anonymous inner class: - *
- * FloatIterable floats = - * people.collectFloat(new FloatFunction<Person>() - * { - * public float floatValueOf(Person person) - * { - * return person.getHeightInInches(); - * } - * }); - ** * @since 4.0 */ @@ -1002,18 +728,6 @@ default
- * Example using an anonymous inner class: - *
- * FloatArrayList floats = - * people.collectFloat(new FloatFunction<Person>() - * { - * public float floatValueOf(Person person) - * { - * return person.getHeightInInches(); - * } - * }, new FloatArrayList()); - ** * @param floatFunction a {@link FloatFunction} to use as the collect transformation function * @param target the MutableFloatCollection to append to for all elements in this {@code RichIterable} @@ -1035,18 +749,6 @@ default
- * Example using an anonymous inner class: - *
- * IntIterable ints = - * people.collectInt(new IntFunction<Person>() - * { - * public int intValueOf(Person person) - * { - * return person.getAge(); - * } - * }); - ** * @since 4.0 */ @@ -1061,18 +763,6 @@ default
- * Example using an anonymous inner class: - *
- * IntArrayList ints = - * people.collectInt(new IntFunction<Person>() - * { - * public int intValueOf(Person person) - * { - * return person.getAge(); - * } - * }, new IntArrayList()); - ** * @param intFunction a {@link IntFunction} to use as the collect transformation function * @param target the MutableIntCollection to append to for all elements in this {@code RichIterable} @@ -1094,18 +784,6 @@ default
- * Example using an anonymous inner class: - *
- * LongIterable longs = - * people.collectLong(new LongFunction<Person>() - * { - * public long longValueOf(Person person) - * { - * return person.getGuid(); - * } - * }); - ** * @since 4.0 */ @@ -1120,18 +798,6 @@ default
- * Example using an anonymous inner class: - *
- * LongArrayList longs = - * people.collectLong(new LongFunction<Person>() - * { - * public long longValueOf(Person person) - * { - * return person.getGuid(); - * } - * }, new LongArrayList()); - ** * @param longFunction a {@link LongFunction} to use as the collect transformation function * @param target the MutableLongCollection to append to for all elements in this {@code RichIterable} @@ -1153,18 +819,6 @@ default
- * Example using an anonymous inner class: - *
- * ShortIterable shorts = - * people.collectShort(new ShortFunction<Person>() - * { - * public short shortValueOf(Person person) - * { - * return person.getNumberOfJunkMailItemsReceivedPerMonth(); - * } - * }); - ** * @since 4.0 */ @@ -1179,18 +833,6 @@ default
- * Example using an anonymous inner class: - *
- * ShortArrayList shorts = - * people.collectShort(new ShortFunction<Person>() - * { - * public short shortValueOf(Person person) - * { - * return person.getNumberOfJunkMailItemsReceivedPerMonth; - * } - * }, new ShortArrayList()); - ** * @param shortFunction a {@link ShortFunction} to use as the collect transformation function * @param target the MutableShortCollection to append to for all elements in this {@code RichIterable} @@ -1211,20 +853,6 @@ default
- * Example using an anonymous inner class: - *
- * Function2<Integer, Integer, Integer> addParameterFunction = - * new Function2<Integer, Integer, Integer>() - * { - * public Integer value(Integer each, Integer parameter) - * { - * return each + parameter; - * } - * }; - * RichIterable<Integer> integers = - * Lists.mutable.with(1, 2, 3).collectWith(addParameterFunction, Integer.valueOf(1)); - ** * @param function A {@link Function2} to use as the collect transformation function * @param parameter A parameter to pass in for evaluation of the second argument {@code P} in {@code function} @@ -1242,20 +870,6 @@ default
- * Example using an anonymous inner class: - *
- * Function2<Integer, Integer, Integer> addParameterFunction = - * new Function2<Integer, Integer, Integer>() - * { - * public Integer value(final Integer each, final Integer parameter) - * { - * return each + parameter; - * } - * }; - * MutableSet<Integer> integers = - * Lists.mutable.with(1, 2, 3).collectWith(addParameterFunction, Integer.valueOf(1), Sets.mutable.empty()); - ** * @param function a {@link Function2} to use as the collect transformation function * @param parameter a parameter to pass in for evaluation of the second argument {@code P} in {@code function} @@ -1474,18 +1088,6 @@ default
> R flatCollectWith(Function2 super T, ? * 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"); - * } - * }); - ** * @since 1.0 */ @@ -1500,18 +1102,6 @@ default
> R flatCollectWith(Function2 super T, ? * 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"); - ** * @since 5.0 */ @@ -1578,18 +1168,6 @@
T detectWithIfNone( * 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"); - * } - * }); - ** * @since 1.0 */ @@ -2524,18 +2102,6 @@ default void appendString(Appendable appendable, String separator) * 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(); - * } - * }); - ** * @since 1.0 */ @@ -2616,18 +2182,6 @@ default
- * 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>()); - ** * @since 1.0 */ diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/Iterate.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/Iterate.java index 4b42dd4393..86ec1dc699 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/Iterate.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/Iterate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Goldman Sachs and others. + * Copyright (c) 2023 Goldman Sachs and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v. 1.0 which accompany this distribution. @@ -113,17 +113,6 @@ private Iterate() *
* Iterate.forEach(people, person -> LOGGER.info(person.getName()); *- *
- * Example using an anonymous inner class: - *
- * Iterate.forEach(people, new Procedure<Person>() - * { - * public void value(Person person) - * { - * LOGGER.info(person.getName()); - * } - * }); - **/ public static
e.g. - * Iterate.forEachWith(people, new Procedure2<Person, Person>() - * { - * public void value(Person person, Person other) - * { - * if (person.isRelatedTo(other)) - * { - * LOGGER.info(person.getName()); - * } - * } - * }, fred); - **/ public static
* Iterate.forEachWithIndex(people, (Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName())); *- *
- * Example using anonymous inner class: - *
- * Iterate.forEachWithIndex(people, new ObjectIntProcedure<Person>() - * { - * public void value(Person person, int index) - * { - * LOGGER.info("Index: " + index + " person: " + person.getName()); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
e.g. - * Collection<Person> selected = - * Iterate.select(people, new Predicate<Person>() - * { - * public boolean accept(Person person) - * { - * return person.getAddress().getCity().equals("Metuchen"); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * Collection<Person> selected = - * Iterate.selectWith(people, new Predicate2<Person, Integer>() - * { - * public boolean accept(Person person, Integer age) - * { - * return person.getAge() >= age; - * } - * }, Integer.valueOf(18)); - **/ public static
- * Example using an anonymous inner class: - *
- * Twin<MutableList<Person>>selectedRejected = - * Iterate.selectAndRejectWith(people, new Predicate2<String, String>() - * { - * public boolean accept(Person person, String lastName) - * { - * return lastName.equals(person.getLastName()); - * } - * }, "Mason"); - **/ public static
- * Example using an anonymous inner class: - *
- * PartitionIterable<Person> newYorkersAndNonNewYorkers = - * Iterate.partition(people, new Predicate<Person>() - * { - * public boolean accept(Person person) - * { - * return person.getAddress().getState().getName().equals("New York"); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * PartitionIterable<Person> newYorkersAndNonNewYorkers = - * Iterate.partitionWith(people, new Predicate<Person, String>() - * { - * public boolean accept(Person person, String state) - * { - * return person.getAddress().getState().getName().equals(state); - * } - * }, "New York"); - ** * @since 5.0. */ @@ -523,17 +429,6 @@ public static
* int count = Iterate.count(people, person -> person.getAddress().getState().getName().equals("New York")); *- *
- * Example using anonymous inner class - *
- * int count = Iterate.count(people, new Predicate<Person>() - * { - * public boolean accept(Person person) - * { - * return person.getAddress().getState().getName().equals("New York"); - * } - * }); - **/ public static
- * Example using anonymous inner class: - *
- * MutableList<Person> selected = - * Iterate.select(people, new Predicate<Person>() - * { - * public boolean accept(Person person) - * { - * return person.person.getLastName().equals("Smith"); - * } - * }, FastList.newList()); - *- *
* Example using Predicates factory: *
* MutableList<Person> selected = Iterate.select(collection, Predicates.attributeEqual("lastName", "Smith"), FastList.newList()); @@ -804,19 +687,6 @@ public static*Collection drop(Iterable iterable, int count) * Iterate.reject(people, person -> person.person.getLastName().equals("Smith")); *
- * Example using anonymous inner class: - *
- * Collection<Person> rejected = - * Iterate.reject(people, - * new Predicate<Person>() - * { - * public boolean accept(Person person) - * { - * return person.person.getLastName().equals("Smith"); - * } - * }); - *- *
* Example using Predicates factory: *
* Collection<Person> rejected = @@ -983,18 +853,6 @@ public static- *boolean removeIfWith( * Collection<Person> rejected = * Iterate.rejectWith(people, (Person person, Integer age) -> person.getAge() >= age, Integer.valueOf(18)); *
- * Example using an anonymous inner class: - *
- * Collection<Person> rejected = - * Iterate.rejectWith(people, new Predicate2<Person, Integer>() - * { - * public boolean accept(Person person, Integer age) - * { - * return person.getAge() >= age; - * } - * }, Integer.valueOf(18)); - **/ public static
- * Example using anonymous inner class: - *
- * MutableList<Person> rejected = - * Iterate.reject( - * people, - * new Predicate<Person>() - * { - * public boolean accept(Person person) - * { - * return person.person.getLastName().equals("Smith"); - * } - * }, - * FastList.newList()); - *- *
* Example using Predicates factory: *
* MutableList<Person> rejected = @@ -1176,20 +1019,6 @@ public static- *boolean removeAllIterable(Iterable extends T> iterable, Coll * Collection<String> names = * Iterate.collect(people, person -> person.getFirstName() + " " + person.getLastName()); *
- * Example using an anonymous inner class: - *
- * Collection<String> names = - * Iterate.collect( - * people, - * new Function<Person, String>() - * { - * public String valueOf(Person person) - * { - * return person.getFirstName() + " " + person.getLastName(); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * MutableList<String> names = - * Iterate.collect( - * people, - * new Function<Person, String>() - * { - * public String valueOf(Person person) - * { - * return person.getFirstName() + " " + person.getLastName(); - * } - * }, - * FastList.newList()); - **/ public static
- * Example using anonymous inner class: - *
- * MutableBooleanCollection voters = - * Iterate.collectBoolean( - * people, - * new BooleanFunction<Person>() - * { - * public boolean booleanValueOf(Person person) - * { - * return person.canVote(); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * BooleanArrayList voters = - * Iterate.collectBoolean( - * people, - * new BooleanFunction<Person>() - * { - * public boolean booleanValueOf(Person person) - * { - * return person.canVote(); - * } - * }, - * new BooleanArrayList()); - **/ public static
- * Example using anonymous inner class: - *
- * MutableByteCollection bytes = - * Iterate.collectByte( - * people, - * new ByteFunction<Person>() - * { - * public byte byteValueOf(Person person) - * { - * return person.getCode(); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * ByteArrayList bytes = - * Iterate.collectByte( - * people, - * new ByteFunction<Person>() - * { - * public byte byteValueOf(Person person) - * { - * return person.getCode(); - * } - * }, - * new ByteArrayList()); - **/ public static
- * Example using anonymous inner class: - *
- * MutableCharCollection chars = - * Iterate.collectChar( - * people, - * new CharFunction<Person>() - * { - * public char charValueOf(Person person) - * { - * return person.getMiddleInitial(); - * } - * }); - **/ public static
- * Example using anonymous inner class: - *
- * CharArrayList chars = - * Iterate.collectChar( - * people, - * new CharFunction<Person>() - * { - * public char charValueOf(Person person) - * { - * return person.getMiddleInitial(); - * } - * }, - * new CharArrayList()); - **/ public static
- * MutableDoubleCollection doubles = - * Iterate.collectDouble(people, - * new DoubleFunction<Person>() - * { - * public double doubleValueOf(Person person) - * { - * return person.getMilesFromNorthPole(); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * DoubleArrayList doubles = - * Iterate.collectDouble(people, - * new DoubleFunction<Person>() - * { - * public double doubleValueOf(Person person) - * { - * return person.getMilesFromNorthPole(); - * } - * }, new DoubleArrayList()); - **/ public static
- * Example using an anonymous inner class: - *
- * MutableFloatCollection floats = - * Iterate.collectFloat(people, - * new FloatFunction<Person>() - * { - * public float floatValueOf(Person person) - * { - * return person.getHeightInInches(); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * FloatArrayList floats = - * Iterate.collectFloat(people, - * new FloatFunction<Person>() - * { - * public float floatValueOf(Person person) - * { - * return person.getHeightInInches(); - * } - * }, new FloatArrayList()); - **/ public static
- * Example using an anonymous inner class: - *
- * MutableIntCollection ages = - * Iterate.collectInt(people, - * new IntFunction<Person>() - * { - * public int intValueOf(Person person) - * { - * return person.getAge(); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * IntArrayList ages = - * Iterate.collectInt(people, - * new IntFunction<Person>() - * { - * public int intValueOf(Person person) - * { - * return person.getAge(); - * } - * }, new IntArrayList()); - **/ public static
- * Example using an anonymous inner class: - *
- * MutableLongCollection longs = - * Iterate.collectLong(people, - * new LongFunction<Person>() - * { - * public long longValueOf(Person person) - * { - * return person.getGuid(); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * LongArrayList longs = - * Iterate.collectLong(people, - * new LongFunction<Person>() - * { - * public long longValueOf(Person person) - * { - * return person.getGuid(); - * } - * }, new LongArrayList()); - **/ public static
- * Example using an anonymous inner class: - *
- * MutableShortCollection shorts = - * Iterate.collectShort(people, - * new ShortFunction<Person>() - * { - * public short shortValueOf(Person person) - * { - * return person.getNumberOfJunkMailItemsReceivedPerMonth(); - * } - * }); - **/ public static
- * Example using an anonymous inner class: - *
- * ShortArrayList shorts = - * Iterate.collectShort(people, - * new ShortFunction<Person>() - * { - * public short shortValueOf(Person person) - * { - * return person.getNumberOfJunkMailItemsReceivedPerMonth(); - * } - * }, new ShortArrayList()); - **/ public static
* Person person = Iterate.detect(people, person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith")); *- *
- * Example using an anonymous inner class: - *
- * Person person = Iterate.detect(people, new Predicate<Person>() - * { - * public boolean accept(Person person) - * { - * return person.getFirstName().equals("John") && person.getLastName().equals("Smith"); - * } - * }); - **/ public static
* Person person = Iterate.detectWith(people, (person, fullName) -> person.getFullName().equals(fullName), "John Smith"); *- *
- * Example using an anonymous inner class: - *
- * Person person = Iterate.detectWith(people, new Predicate2<Person, String>() - * { - * public boolean accept(Person person, String fullName) - * { - * return person.getFullName().equals(fullName); - * } - * }, "John Smith"); - **/ public static
- * Example using an anonymous inner class: - *
- * MutableMultimap<String, String> multimap = - * Iterate.groupByAndCollect(integers, - * new Function<Integer, String>() - * { - * public String valueOf(Integer each) - * { - * return "key:" + each; - * } - * }, new Function<Integer, Iterable<String>>() - * { - * public Iterable<String> valueOf(Integer each) - * { - * return Lists.mutable.of("value:" + each); - * } - * }, FastListMultimap.newMultimap()); - ** * @see Iterate#groupBy(Iterable, Function) when only keys get transformed * @see Iterate#groupByEach(Iterable, Function) when only keys get transformed and Function returns multiple keys @@ -3465,25 +3022,6 @@ public static
- * Example using an anonymous inner class: - *
- * MutableMultimap<String, String> multimap = - * Iterate.groupByAndCollect(integers, - * new Function<Integer, String>() - * { - * public String valueOf(Integer each) - * { - * return "key:" + each; - * } - * }, new Function<Integer, String>() - * { - * public String valueOf(Integer each) - * { - * return "value:" + each; - * } - * }, FastListMultimap.newMultimap()); - ** * @see Iterate#groupBy(Iterable, Function) when only keys get transformed * @see Iterate#groupByEach(Iterable, Function) when function returns multiple keys