From 71aa9f9dddbb5a9648752510ac5d140e1914abf3 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Tue, 26 Apr 2022 00:02:33 -0400 Subject: [PATCH] Use interfaces instead of implementations where possible for local variables. Signed-off-by: Craig P. Motlin --- .../forkjoin/FJIterateAcceptanceTest.java | 6 +-- .../ParallelIterateAcceptanceTest.java | 6 +-- .../set/mutable/UnifiedSetAcceptanceTest.java | 7 ++-- .../EclipseCollectionsCodeGenerator.java | 5 ++- .../collections/impl/forkjoin/FJIterate.java | 16 ++++---- .../impl/forkjoin/FJIterateTest.java | 6 +-- .../impl/test/SerializeTestHelper.java | 8 ++-- .../eclipse/collections/impl/test/Verify.java | 3 +- .../impl/AbstractRichIterable.java | 4 +- .../parallel/ParallelDistinctIterable.java | 9 +++-- .../list/ParallelDistinctListIterable.java | 9 +++-- .../collections/impl/list/Interval.java | 6 +-- .../primitive/ImmutableBooleanArrayList.java | 4 +- .../mutable/primitive/BooleanArrayList.java | 2 +- .../stack/immutable/ImmutableArrayStack.java | 3 +- .../ImmutableStackSerializationProxy.java | 5 ++- .../impl/utility/ArrayListIterate.java | 4 +- .../internal/RandomAccessListIterate.java | 4 +- .../ImmutableHashBiMapSerializationTest.java | 5 ++- .../CollectIterableSerializationTest.java | 26 ++++++++----- .../MutableSortedBagNoComparatorTestCase.java | 4 +- .../list/mutable/CompositeFastListTest.java | 4 +- .../immutable/ImmutableSingletonBagTest.java | 4 +- .../primitive/SynchronizedBooleanBagTest.java | 4 +- .../impl/block/CheckedBlocksTest.java | 33 ++++++++-------- .../comparator/FunctionComparatorTest.java | 4 +- .../impl/block/function/CaseFunctionTest.java | 2 +- .../impl/block/function/IfFunctionTest.java | 5 ++- .../primitive/BooleanCaseFunctionTest.java | 3 +- ...daptObjectIntProcedureToProcedureTest.java | 3 +- .../procedure/AtomicCountProcedureTest.java | 3 +- ...imapKeyValuesSerializingProcedureTest.java | 6 ++- .../CheckedBooleanIntProcedureTest.java | 3 +- .../CollectBooleanProcedureTest.java | 5 ++- .../SingletonBooleanIteratorTest.java | 3 +- .../impl/lazy/CollectIterableTest.java | 20 +++++----- .../impl/lazy/DistinctIterableTest.java | 13 +++---- .../impl/lazy/FlatCollectIterableTest.java | 13 +++---- .../impl/lazy/RejectIterableTest.java | 13 +++---- .../lazy/SelectInstancesOfIterableTest.java | 13 +++---- .../impl/lazy/SelectIterableTest.java | 13 +++---- .../impl/lazy/TapIterableTest.java | 11 +++--- .../lazy/iterator/DistinctIteratorTest.java | 3 +- .../iterator/FlatCollectIteratorTest.java | 6 +-- .../impl/lazy/iterator/TapIteratorTest.java | 7 ++-- .../primitive/TapBooleanIterableTest.java | 25 ++++++------ .../collections/impl/list/IntervalTest.java | 6 +-- .../AbstractImmutableBooleanListTestCase.java | 4 +- .../list/mutable/AbstractListTestCase.java | 4 +- .../list/mutable/CompositeFastListTest.java | 8 ++-- .../impl/list/mutable/FastListTest.java | 4 +- .../primitive/BooleanArrayListTest.java | 6 +-- .../mutable/MutableMapIterableTestCase.java | 2 +- .../impl/map/mutable/UnifiedMapTestCase.java | 4 +- .../ImmutableEmptySortedMapTest.java | 7 ++-- .../immutable/ImmutableTreeMapTest.java | 19 +++++----- .../UnifiedMapWithHashingStrategyTest.java | 4 +- .../impl/parallel/ParallelIterateTest.java | 6 +-- .../partition/bag/PartitionHashBagTest.java | 3 +- .../bag/sorted/PartitionTreeBagTest.java | 3 +- .../partition/list/PartitionFastListTest.java | 3 +- .../set/PartitionUnifiedSetTest.java | 3 +- .../sorted/PartitionTreeSortedSetTest.java | 3 +- ...tionUnifiedSetWithHashingStrategyTest.java | 3 +- .../UnifiedSetWithHashingStrategyTest.java | 5 ++- .../primitive/AbstractBooleanSetTestCase.java | 4 +- .../primitive/AbstractByteSetTestCase.java | 4 +- .../mutable/primitive/BooleanHashSetTest.java | 5 ++- .../mutable/primitive/ByteHashSetTest.java | 4 +- .../ImmutableBooleanHashSetTest.java | 4 +- .../primitive/LongHashSetExtraTest.java | 5 ++- .../impl/stack/mutable/ArrayStackTest.java | 6 +-- .../AbstractBooleanStackTestCase.java | 5 ++- .../tuple/AbstractImmutableEntryTest.java | 8 ++-- .../impl/utility/ArrayListIterateTest.java | 38 +++++++++---------- .../impl/utility/ListIterateTest.java | 10 ++--- .../impl/utility/MapIterateTest.java | 5 ++- .../utility/internal/IterableIterateTest.java | 4 +- 78 files changed, 298 insertions(+), 262 deletions(-) diff --git a/acceptance-tests/src/test/java/org/eclipse/collections/impl/forkjoin/FJIterateAcceptanceTest.java b/acceptance-tests/src/test/java/org/eclipse/collections/impl/forkjoin/FJIterateAcceptanceTest.java index 3e28cc3d0d..55e2af0b16 100644 --- a/acceptance-tests/src/test/java/org/eclipse/collections/impl/forkjoin/FJIterateAcceptanceTest.java +++ b/acceptance-tests/src/test/java/org/eclipse/collections/impl/forkjoin/FJIterateAcceptanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -291,7 +291,7 @@ public void testForEachWithException() public void testForEachWithIndexToArrayUsingFastListSerialPath() { Integer[] array = new Integer[200]; - FastList list = (FastList) Interval.oneTo(200).toList(); + MutableList list = new FastList<>(Interval.oneTo(200)); Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull())); FJIterate.forEachWithIndex(list, (each, index) -> array[index] = each); Assert.assertArrayEquals(array, list.toArray(new Integer[]{})); @@ -301,7 +301,7 @@ public void testForEachWithIndexToArrayUsingFastListSerialPath() public void testForEachWithIndexToArrayUsingFastList() { Integer[] array = new Integer[200]; - FastList list = (FastList) Interval.oneTo(200).toList(); + MutableList list = new FastList<>(Interval.oneTo(200)); Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull())); FJIterate.forEachWithIndex(list, (each, index) -> array[index] = each, 10, 10); Assert.assertArrayEquals(array, list.toArray(new Integer[]{})); diff --git a/acceptance-tests/src/test/java/org/eclipse/collections/impl/parallel/ParallelIterateAcceptanceTest.java b/acceptance-tests/src/test/java/org/eclipse/collections/impl/parallel/ParallelIterateAcceptanceTest.java index ae0843c1c4..c46be25480 100644 --- a/acceptance-tests/src/test/java/org/eclipse/collections/impl/parallel/ParallelIterateAcceptanceTest.java +++ b/acceptance-tests/src/test/java/org/eclipse/collections/impl/parallel/ParallelIterateAcceptanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -297,7 +297,7 @@ public void testForEachWithException() public void testForEachWithIndexToArrayUsingFastListSerialPath() { Integer[] array = new Integer[200]; - FastList list = (FastList) Interval.oneTo(200).toList(); + MutableList list = new FastList<>(Interval.oneTo(200)); Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull())); ParallelIterate.forEachWithIndex(list, (each, index) -> array[index] = each); Assert.assertArrayEquals(array, list.toArray(new Integer[]{})); @@ -307,7 +307,7 @@ public void testForEachWithIndexToArrayUsingFastListSerialPath() public void testForEachWithIndexToArrayUsingFastList() { Integer[] array = new Integer[200]; - FastList list = (FastList) Interval.oneTo(200).toList(); + MutableList list = new FastList<>(Interval.oneTo(200)); Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull())); ParallelIterate.forEachWithIndex(list, (each, index) -> array[index] = each, 10, 10); Assert.assertArrayEquals(array, list.toArray(new Integer[]{})); diff --git a/acceptance-tests/src/test/java/org/eclipse/collections/impl/set/mutable/UnifiedSetAcceptanceTest.java b/acceptance-tests/src/test/java/org/eclipse/collections/impl/set/mutable/UnifiedSetAcceptanceTest.java index 912b976df9..50cbd09260 100644 --- a/acceptance-tests/src/test/java/org/eclipse/collections/impl/set/mutable/UnifiedSetAcceptanceTest.java +++ b/acceptance-tests/src/test/java/org/eclipse/collections/impl/set/mutable/UnifiedSetAcceptanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -21,6 +21,7 @@ import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.api.set.MutableSet; +import org.eclipse.collections.api.set.Pool; import org.eclipse.collections.impl.CollidingInt; import org.eclipse.collections.impl.block.factory.Procedures; import org.eclipse.collections.impl.factory.Lists; @@ -789,7 +790,7 @@ private void runUnifiedSetAsPool(int shift) { CollidingInt[] toPool = new CollidingInt[5000]; - UnifiedSet set = new UnifiedSet<>(); + Pool set = new UnifiedSet<>(); for (int i = 0; i < toPool.length; i++) { @@ -842,7 +843,7 @@ private void runUnifiedSetAsPoolRandomInput(int shift) toPool = shuffle(toPool); - UnifiedSet set = new UnifiedSet<>(); + Pool set = new UnifiedSet<>(); for (int i = 0; i < toPool.length; i++) { Assert.assertSame(toPool[i], set.put(toPool[i])); diff --git a/eclipse-collections-code-generator/src/main/java/org/eclipse/collections/codegenerator/EclipseCollectionsCodeGenerator.java b/eclipse-collections-code-generator/src/main/java/org/eclipse/collections/codegenerator/EclipseCollectionsCodeGenerator.java index 256c860fde..40bb3acf1f 100644 --- a/eclipse-collections-code-generator/src/main/java/org/eclipse/collections/codegenerator/EclipseCollectionsCodeGenerator.java +++ b/eclipse-collections-code-generator/src/main/java/org/eclipse/collections/codegenerator/EclipseCollectionsCodeGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -23,6 +23,7 @@ import org.eclipse.collections.codegenerator.tools.FileUtils; import org.eclipse.collections.codegenerator.tools.IntegerOrStringRenderer; import org.stringtemplate.v4.ST; +import org.stringtemplate.v4.STErrorListener; import org.stringtemplate.v4.STGroupFile; public class EclipseCollectionsCodeGenerator @@ -67,7 +68,7 @@ public int generateFiles() continue; } - LoggingErrorListener stErrorListener = new LoggingErrorListener(this.errorListener, url); + STErrorListener stErrorListener = new LoggingErrorListener(this.errorListener, url); templateFile.setListener(stErrorListener); templateFile.registerRenderer(String.class, new IntegerOrStringRenderer()); diff --git a/eclipse-collections-forkjoin/src/main/java/org/eclipse/collections/impl/forkjoin/FJIterate.java b/eclipse-collections-forkjoin/src/main/java/org/eclipse/collections/impl/forkjoin/FJIterate.java index 1170d448c8..f37602adde 100644 --- a/eclipse-collections-forkjoin/src/main/java/org/eclipse/collections/impl/forkjoin/FJIterate.java +++ b/eclipse-collections-forkjoin/src/main/java/org/eclipse/collections/impl/forkjoin/FJIterate.java @@ -111,8 +111,8 @@ public static > void forEachWithInde PT procedure, ForkJoinPool executor) { - PassThruObjectIntProcedureFactory procedureFactory = new PassThruObjectIntProcedureFactory<>(procedure); - PassThruCombiner combiner = new PassThruCombiner<>(); + ObjectIntProcedureFactory procedureFactory = new PassThruObjectIntProcedureFactory<>(procedure); + Combiner combiner = new PassThruCombiner<>(); FJIterate.forEachWithIndex(iterable, procedureFactory, combiner, executor); } @@ -131,8 +131,8 @@ public static > void forEachWithInde int minForkSize, int taskCount) { - PassThruObjectIntProcedureFactory procedureFactory = new PassThruObjectIntProcedureFactory<>(procedure); - PassThruCombiner combiner = new PassThruCombiner<>(); + ObjectIntProcedureFactory procedureFactory = new PassThruObjectIntProcedureFactory<>(procedure); + Combiner combiner = new PassThruCombiner<>(); FJIterate.forEachWithIndex(iterable, procedureFactory, combiner, minForkSize, taskCount); } @@ -269,8 +269,8 @@ public static > void forEach( PT procedure, ForkJoinPool executor) { - PassThruProcedureFactory procedureFactory = new PassThruProcedureFactory<>(procedure); - PassThruCombiner combiner = new PassThruCombiner<>(); + ProcedureFactory procedureFactory = new PassThruProcedureFactory<>(procedure); + Combiner combiner = new PassThruCombiner<>(); FJIterate.forEach(iterable, procedureFactory, combiner, executor); } @@ -298,8 +298,8 @@ public static > void forEach( int taskCount, ForkJoinPool executor) { - PassThruProcedureFactory procedureFactory = new PassThruProcedureFactory<>(procedure); - PassThruCombiner combiner = new PassThruCombiner<>(); + ProcedureFactory procedureFactory = new PassThruProcedureFactory<>(procedure); + Combiner combiner = new PassThruCombiner<>(); FJIterate.forEach(iterable, procedureFactory, combiner, minForkSize, taskCount, executor); } diff --git a/eclipse-collections-forkjoin/src/test/java/org/eclipse/collections/impl/forkjoin/FJIterateTest.java b/eclipse-collections-forkjoin/src/test/java/org/eclipse/collections/impl/forkjoin/FJIterateTest.java index 301fa41c58..ea905623fb 100644 --- a/eclipse-collections-forkjoin/src/test/java/org/eclipse/collections/impl/forkjoin/FJIterateTest.java +++ b/eclipse-collections-forkjoin/src/test/java/org/eclipse/collections/impl/forkjoin/FJIterateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -277,7 +277,7 @@ public void testForEachWithException() public void testForEachWithIndexToArrayUsingFastListSerialPath() { Integer[] array = new Integer[200]; - FastList list = (FastList) Interval.oneTo(200).toList(); + MutableList list = new FastList<>(Interval.oneTo(200)); Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull())); FJIterate.forEachWithIndex(list, (each, index) -> array[index] = each); Assert.assertArrayEquals(array, list.toArray(new Integer[]{})); @@ -287,7 +287,7 @@ public void testForEachWithIndexToArrayUsingFastListSerialPath() public void testForEachWithIndexToArrayUsingFastList() { Integer[] array = new Integer[200]; - FastList list = (FastList) Interval.oneTo(200).toList(); + MutableList list = new FastList<>(Interval.oneTo(200)); Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull())); FJIterate.forEachWithIndex(list, (each, index) -> array[index] = each, 10, 10); Assert.assertArrayEquals(array, list.toArray(new Integer[]{})); diff --git a/eclipse-collections-testutils/src/main/java/org/eclipse/collections/impl/test/SerializeTestHelper.java b/eclipse-collections-testutils/src/main/java/org/eclipse/collections/impl/test/SerializeTestHelper.java index e1805ce6af..506dcbf488 100644 --- a/eclipse-collections-testutils/src/main/java/org/eclipse/collections/impl/test/SerializeTestHelper.java +++ b/eclipse-collections-testutils/src/main/java/org/eclipse/collections/impl/test/SerializeTestHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -13,7 +13,9 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.ObjectInput; import java.io.ObjectInputStream; +import java.io.ObjectOutput; import java.io.ObjectOutputStream; public final class SerializeTestHelper @@ -51,7 +53,7 @@ public static ByteArrayOutputStream getByteArrayOutputStream(T sourceObject) private static void writeObjectToStream(Object sourceObject, ByteArrayOutputStream baos) throws IOException { - try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(baos)) + try (ObjectOutput objectOutputStream = new ObjectOutputStream(baos)) { objectOutputStream.writeObject(sourceObject); objectOutputStream.flush(); @@ -62,7 +64,7 @@ private static void writeObjectToStream(Object sourceObject, ByteArrayOutput private static Object readOneObject(ByteArrayInputStream bais) throws IOException, ClassNotFoundException { - try (ObjectInputStream objectStream = new ObjectInputStream(bais)) + try (ObjectInput objectStream = new ObjectInputStream(bais)) { return objectStream.readObject(); } diff --git a/eclipse-collections-testutils/src/main/java/org/eclipse/collections/impl/test/Verify.java b/eclipse-collections-testutils/src/main/java/org/eclipse/collections/impl/test/Verify.java index 0d656ea558..aa48005c7c 100644 --- a/eclipse-collections-testutils/src/main/java/org/eclipse/collections/impl/test/Verify.java +++ b/eclipse-collections-testutils/src/main/java/org/eclipse/collections/impl/test/Verify.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.io.NotSerializableException; import java.io.ObjectInputStream; +import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.io.ObjectStreamClass; import java.io.Serializable; @@ -3356,7 +3357,7 @@ private static String encodeObject(Object actualObject) try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); + ObjectOutput objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); objectOutputStream.writeObject(actualObject); objectOutputStream.flush(); objectOutputStream.close(); diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/AbstractRichIterable.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/AbstractRichIterable.java index d09966450d..f4afb39bcc 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/AbstractRichIterable.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/AbstractRichIterable.java @@ -602,14 +602,14 @@ public String toString() @Override public void appendString(Appendable appendable, String separator) { - AppendStringProcedure appendStringProcedure = new AppendStringProcedure<>(appendable, separator); + Procedure appendStringProcedure = new AppendStringProcedure<>(appendable, separator); this.forEach(appendStringProcedure); } @Override public void appendString(Appendable appendable, String start, String separator, String end) { - AppendStringProcedure appendStringProcedure = new AppendStringProcedure<>(appendable, separator); + Procedure appendStringProcedure = new AppendStringProcedure<>(appendable, separator); try { appendable.append(start); diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/lazy/parallel/ParallelDistinctIterable.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/lazy/parallel/ParallelDistinctIterable.java index 49d1b7b4c5..9371884b86 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/lazy/parallel/ParallelDistinctIterable.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/lazy/parallel/ParallelDistinctIterable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -17,6 +17,7 @@ import org.eclipse.collections.api.block.function.Function; import org.eclipse.collections.api.block.predicate.Predicate; import org.eclipse.collections.api.block.procedure.Procedure; +import org.eclipse.collections.api.map.ConcurrentMutableMap; import org.eclipse.collections.api.map.MapIterable; import org.eclipse.collections.api.multimap.set.UnsortedSetMultimap; import org.eclipse.collections.api.set.ParallelUnsortedSetIterable; @@ -66,7 +67,7 @@ public ParallelUnsortedSetIterable asUnique() public void forEach(Procedure procedure) { // TODO: Replace the map with a concurrent set once it's implemented - ConcurrentHashMap distinct = new ConcurrentHashMap<>(); + ConcurrentMutableMap distinct = new ConcurrentHashMap<>(); this.delegate.forEach(each -> { if (distinct.put(each, true) == null) { @@ -131,7 +132,7 @@ public MapIterable groupByUniqueKey(Function f private static final class DistinctAndPredicate implements Predicate { // TODO: Replace the map with a concurrent set once it's implemented - private final ConcurrentHashMap distinct = new ConcurrentHashMap<>(); + private final ConcurrentMutableMap distinct = new ConcurrentHashMap<>(); private final Predicate predicate; private DistinctAndPredicate(Predicate predicate) @@ -149,7 +150,7 @@ public boolean accept(T each) private static final class DistinctOrPredicate implements Predicate { // TODO: Replace the map with a concurrent set once it's implemented - private final ConcurrentHashMap distinct = new ConcurrentHashMap<>(); + private final ConcurrentMutableMap distinct = new ConcurrentHashMap<>(); private final Predicate predicate; private DistinctOrPredicate(Predicate predicate) diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/lazy/parallel/list/ParallelDistinctListIterable.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/lazy/parallel/list/ParallelDistinctListIterable.java index 9d90efeef2..6f2f88a1a4 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/lazy/parallel/list/ParallelDistinctListIterable.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/lazy/parallel/list/ParallelDistinctListIterable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -17,6 +17,7 @@ import org.eclipse.collections.api.block.function.Function; import org.eclipse.collections.api.block.predicate.Predicate; import org.eclipse.collections.api.block.procedure.Procedure; +import org.eclipse.collections.api.map.ConcurrentMutableMap; import org.eclipse.collections.api.map.MapIterable; import org.eclipse.collections.api.multimap.set.UnsortedSetMultimap; import org.eclipse.collections.api.set.ParallelUnsortedSetIterable; @@ -65,7 +66,7 @@ public ParallelUnsortedSetIterable asUnique() public void forEach(Procedure procedure) { // TODO: Replace the map with a concurrent set once it's implemented - ConcurrentHashMap distinct = new ConcurrentHashMap<>(); + ConcurrentMutableMap distinct = new ConcurrentHashMap<>(); this.delegate.forEach(each -> { if (distinct.put(each, true) == null) { @@ -130,7 +131,7 @@ public MapIterable groupByUniqueKey(Function f private static final class DistinctAndPredicate implements Predicate { // TODO: Replace the map with a concurrent set once it's implemented - private final ConcurrentHashMap distinct = new ConcurrentHashMap<>(); + private final ConcurrentMutableMap distinct = new ConcurrentHashMap<>(); private final Predicate predicate; private DistinctAndPredicate(Predicate predicate) @@ -148,7 +149,7 @@ public boolean accept(T each) private static final class DistinctOrPredicate implements Predicate { // TODO: Replace the map with a concurrent set once it's implemented - private final ConcurrentHashMap distinct = new ConcurrentHashMap<>(); + private final ConcurrentMutableMap distinct = new ConcurrentHashMap<>(); private final Predicate predicate; private DistinctOrPredicate(Predicate predicate) diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/Interval.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/Interval.java index 08e78b2d69..2eb4717ddd 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/Interval.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/Interval.java @@ -658,7 +658,7 @@ public > R collect( Function function, R target) { - CollectProcedure procedure = new CollectProcedure<>(function, target); + Procedure procedure = new CollectProcedure<>(function, target); this.forEach(procedure); return target; } @@ -666,7 +666,7 @@ public > R collect( @Override public > R select(Predicate predicate, R target) { - SelectProcedure procedure = new SelectProcedure<>(predicate, target); + Procedure procedure = new SelectProcedure<>(predicate, target); this.forEach(procedure); return target; } @@ -674,7 +674,7 @@ public > R select(Predicate predi @Override public > R reject(Predicate predicate, R target) { - RejectProcedure procedure = new RejectProcedure<>(predicate, target); + Procedure procedure = new RejectProcedure<>(predicate, target); this.forEach(procedure); return target; } diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/immutable/primitive/ImmutableBooleanArrayList.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/immutable/primitive/ImmutableBooleanArrayList.java index 1339331b59..37297a2824 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/immutable/primitive/ImmutableBooleanArrayList.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/immutable/primitive/ImmutableBooleanArrayList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -396,7 +396,7 @@ public ImmutableBooleanArrayList toReversed() @Override public ImmutableBooleanList distinct() { - BooleanArrayList target = new BooleanArrayList(); + MutableBooleanList target = new BooleanArrayList(); MutableBooleanSet seenSoFar = new BooleanHashSet(); for (int i = 0; i < this.size; i++) { diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/mutable/primitive/BooleanArrayList.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/mutable/primitive/BooleanArrayList.java index 739b0b860a..bff93e4c14 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/mutable/primitive/BooleanArrayList.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/list/mutable/primitive/BooleanArrayList.java @@ -754,7 +754,7 @@ public BooleanArrayList toReversed() @Override public MutableBooleanList distinct() { - BooleanArrayList target = new BooleanArrayList(); + MutableBooleanList target = new BooleanArrayList(); MutableBooleanSet seenSoFar = new BooleanHashSet(); for (int i = 0; i < this.size; i++) { diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/stack/immutable/ImmutableArrayStack.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/stack/immutable/ImmutableArrayStack.java index da2dea7cda..41bbe63f42 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/stack/immutable/ImmutableArrayStack.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/stack/immutable/ImmutableArrayStack.java @@ -1214,7 +1214,7 @@ public void safeValue(T object) throws IOException public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { int size = in.readInt(); - FastList deserializedDelegate = new FastList<>(size); + MutableList deserializedDelegate = new FastList<>(size); for (int i = 0; i < size; i++) { @@ -1230,4 +1230,3 @@ protected Object readResolve() } } } - diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/stack/immutable/ImmutableStackSerializationProxy.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/stack/immutable/ImmutableStackSerializationProxy.java index 90b67f8a61..3a027c2256 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/stack/immutable/ImmutableStackSerializationProxy.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/stack/immutable/ImmutableStackSerializationProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -16,6 +16,7 @@ import java.io.ObjectOutput; import org.eclipse.collections.api.factory.Stacks; +import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.api.stack.StackIterable; import org.eclipse.collections.impl.block.procedure.checked.CheckedProcedure; import org.eclipse.collections.impl.list.mutable.FastList; @@ -65,7 +66,7 @@ public void safeValue(T object) throws IOException public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { int size = in.readInt(); - FastList deserializedDelegate = new FastList<>(size); + MutableList deserializedDelegate = new FastList<>(size); for (int i = 0; i < size; i++) { diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/ArrayListIterate.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/ArrayListIterate.java index 544ab5a314..0153b21448 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/ArrayListIterate.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/ArrayListIterate.java @@ -1301,7 +1301,7 @@ public static PartitionMutableList partition(ArrayList list, Predicate int size = list.size(); if (ArrayListIterate.isOptimizableArrayList(list, size)) { - PartitionFastList partitionFastList = new PartitionFastList<>(); + PartitionMutableList partitionFastList = new PartitionFastList<>(); MutableList selected = partitionFastList.getSelected(); MutableList rejected = partitionFastList.getRejected(); @@ -1322,7 +1322,7 @@ public static PartitionMutableList partitionWith(ArrayList list, Pr int size = list.size(); if (ArrayListIterate.isOptimizableArrayList(list, size)) { - PartitionFastList partitionFastList = new PartitionFastList<>(); + PartitionMutableList partitionFastList = new PartitionFastList<>(); MutableList selected = partitionFastList.getSelected(); MutableList rejected = partitionFastList.getRejected(); diff --git a/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/internal/RandomAccessListIterate.java b/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/internal/RandomAccessListIterate.java index 899db63936..8172f0657c 100644 --- a/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/internal/RandomAccessListIterate.java +++ b/eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/internal/RandomAccessListIterate.java @@ -1079,7 +1079,7 @@ public static Twin> selectAndRejectWith( public static PartitionMutableList partition(List list, Predicate predicate) { - PartitionFastList partitionFastList = new PartitionFastList<>(); + PartitionMutableList partitionFastList = new PartitionFastList<>(); int size = list.size(); for (int i = 0; i < size; i++) @@ -1095,7 +1095,7 @@ public static PartitionMutableList partition(List list, Predicate PartitionMutableList partitionWith(List list, Predicate2 predicate, P parameter) { - PartitionFastList partitionFastList = new PartitionFastList<>(); + PartitionMutableList partitionFastList = new PartitionFastList<>(); int size = list.size(); for (int i = 0; i < size; i++) diff --git a/serialization-tests/src/test/java/org/eclipse/collections/impl/bimap/immutable/ImmutableHashBiMapSerializationTest.java b/serialization-tests/src/test/java/org/eclipse/collections/impl/bimap/immutable/ImmutableHashBiMapSerializationTest.java index 3c09f0ab6a..3e176d48f7 100644 --- a/serialization-tests/src/test/java/org/eclipse/collections/impl/bimap/immutable/ImmutableHashBiMapSerializationTest.java +++ b/serialization-tests/src/test/java/org/eclipse/collections/impl/bimap/immutable/ImmutableHashBiMapSerializationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,6 +10,7 @@ package org.eclipse.collections.impl.bimap.immutable; +import org.eclipse.collections.api.bimap.ImmutableBiMap; import org.eclipse.collections.api.factory.Maps; import org.eclipse.collections.impl.test.Verify; import org.junit.Test; @@ -34,7 +35,7 @@ public void serializedForm() @Test public void inverse() { - ImmutableHashBiMap biMap = new ImmutableHashBiMap<>( + ImmutableBiMap biMap = new ImmutableHashBiMap<>( Maps.immutable.with('a', 1), Maps.immutable.with(1, 'a')); diff --git a/serialization-tests/src/test/java/org/eclipse/collections/impl/lazy/primitive/CollectIterableSerializationTest.java b/serialization-tests/src/test/java/org/eclipse/collections/impl/lazy/primitive/CollectIterableSerializationTest.java index 65f61af1ec..6e8dcc2373 100644 --- a/serialization-tests/src/test/java/org/eclipse/collections/impl/lazy/primitive/CollectIterableSerializationTest.java +++ b/serialization-tests/src/test/java/org/eclipse/collections/impl/lazy/primitive/CollectIterableSerializationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,6 +10,14 @@ package org.eclipse.collections.impl.lazy.primitive; +import org.eclipse.collections.api.LazyBooleanIterable; +import org.eclipse.collections.api.LazyByteIterable; +import org.eclipse.collections.api.LazyCharIterable; +import org.eclipse.collections.api.LazyDoubleIterable; +import org.eclipse.collections.api.LazyFloatIterable; +import org.eclipse.collections.api.LazyIntIterable; +import org.eclipse.collections.api.LazyLongIterable; +import org.eclipse.collections.api.LazyShortIterable; import org.eclipse.collections.impl.block.factory.PrimitiveFunctions; import org.junit.Test; @@ -24,7 +32,7 @@ public void intSerialization() + "bnQAQkxvcmcvZWNsaXBzZS9jb2xsZWN0aW9ucy9hcGkvYmxvY2svZnVuY3Rpb24vcHJpbWl0aXZl\n" + "L0ludEZ1bmN0aW9uO3hwc3IAT29yZy5lY2xpcHNlLmNvbGxlY3Rpb25zLmltcGwuYmxvY2suZmFj\n" + "dG9yeS5QcmltaXRpdmVGdW5jdGlvbnMkVW5ib3hJbnRlZ2VyVG9JbnQAAAAAAAAAAQIAAHhw"); - CollectIntIterable collectIntIterable = new CollectIntIterable<>( + LazyIntIterable collectIntIterable = new CollectIntIterable<>( integerLazyIterableTestHelper, PrimitiveFunctions.unboxIntegerToInt()); @@ -41,7 +49,7 @@ public void doubleSerialization() + "bWl0aXZlL0RvdWJsZUZ1bmN0aW9uO3hwc3IAUm9yZy5lY2xpcHNlLmNvbGxlY3Rpb25zLmltcGwu\n" + "YmxvY2suZmFjdG9yeS5QcmltaXRpdmVGdW5jdGlvbnMkVW5ib3hJbnRlZ2VyVG9Eb3VibGUAAAAA\n" + "AAAAAQIAAHhw"); - CollectDoubleIterable collectDoubleIterable = new CollectDoubleIterable<>( + LazyDoubleIterable collectDoubleIterable = new CollectDoubleIterable<>( integerLazyIterableTestHelper, PrimitiveFunctions.unboxIntegerToDouble()); @@ -59,7 +67,7 @@ public void floatSerialization() + "Y2suZmFjdG9yeS5QcmltaXRpdmVGdW5jdGlvbnMkVW5ib3hJbnRlZ2VyVG9GbG9hdAAAAAAAAAAB\n" + "AgAAeHA="); - CollectFloatIterable collectFloatIterable = new CollectFloatIterable<>( + LazyFloatIterable collectFloatIterable = new CollectFloatIterable<>( integerLazyIterableTestHelper, PrimitiveFunctions.unboxIntegerToFloat()); @@ -77,7 +85,7 @@ public void longSerialization() + "ZmFjdG9yeS5QcmltaXRpdmVGdW5jdGlvbnMkVW5ib3hJbnRlZ2VyVG9Mb25nAAAAAAAAAAECAAB4\n" + "cA=="); - CollectLongIterable collectLongIterable = new CollectLongIterable<>( + LazyLongIterable collectLongIterable = new CollectLongIterable<>( integerLazyIterableTestHelper, PrimitiveFunctions.unboxIntegerToLong()); @@ -95,7 +103,7 @@ public void shortSerialization() + "Y2suZmFjdG9yeS5QcmltaXRpdmVGdW5jdGlvbnMkVW5ib3hJbnRlZ2VyVG9TaG9ydAAAAAAAAAAB\n" + "AgAAeHA="); - CollectShortIterable collectShortIterable = new CollectShortIterable<>( + LazyShortIterable collectShortIterable = new CollectShortIterable<>( integerLazyIterableTestHelper, PrimitiveFunctions.unboxIntegerToShort()); @@ -113,7 +121,7 @@ public void byteSerialization() + "ZmFjdG9yeS5QcmltaXRpdmVGdW5jdGlvbnMkVW5ib3hJbnRlZ2VyVG9CeXRlAAAAAAAAAAECAAB4\n" + "cA=="); - CollectByteIterable collectByteIterable = new CollectByteIterable<>( + LazyByteIterable collectByteIterable = new CollectByteIterable<>( integerLazyIterableTestHelper, PrimitiveFunctions.unboxIntegerToByte()); @@ -131,7 +139,7 @@ public void charSerialization() + "ZmFjdG9yeS5QcmltaXRpdmVGdW5jdGlvbnMkVW5ib3hJbnRlZ2VyVG9DaGFyAAAAAAAAAAECAAB4\n" + "cA=="); - CollectCharIterable collectCharIterable = new CollectCharIterable<>( + LazyCharIterable collectCharIterable = new CollectCharIterable<>( integerLazyIterableTestHelper, PrimitiveFunctions.unboxIntegerToChar()); @@ -149,7 +157,7 @@ public void booleanSerialization() + "cGwuYmxvY2suZmFjdG9yeS5QcmltaXRpdmVGdW5jdGlvbnMkSW50ZWdlcklzUG9zaXRpdmUAAAAA\n" + "AAAAAQIAAHhw"); - CollectBooleanIterable collectBooleanIterable = new CollectBooleanIterable<>( + LazyBooleanIterable collectBooleanIterable = new CollectBooleanIterable<>( integerLazyIterableTestHelper, PrimitiveFunctions.integerIsPositive()); diff --git a/unit-tests-java8/src/test/java/org/eclipse/collections/test/bag/mutable/sorted/MutableSortedBagNoComparatorTestCase.java b/unit-tests-java8/src/test/java/org/eclipse/collections/test/bag/mutable/sorted/MutableSortedBagNoComparatorTestCase.java index 461e156e4a..1e4fdd88b8 100644 --- a/unit-tests-java8/src/test/java/org/eclipse/collections/test/bag/mutable/sorted/MutableSortedBagNoComparatorTestCase.java +++ b/unit-tests-java8/src/test/java/org/eclipse/collections/test/bag/mutable/sorted/MutableSortedBagNoComparatorTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -37,7 +37,7 @@ default SortedBag getExpectedFiltered(T... elements) @Override default MutableSortedBag newMutableForFilter(T... elements) { - TreeBag result = new TreeBag<>(); + MutableSortedBag result = new TreeBag<>(); addAllTo(elements, result); return result; } diff --git a/unit-tests-java8/src/test/java/org/eclipse/collections/test/list/mutable/CompositeFastListTest.java b/unit-tests-java8/src/test/java/org/eclipse/collections/test/list/mutable/CompositeFastListTest.java index e3215fd7cf..6d40b7400a 100644 --- a/unit-tests-java8/src/test/java/org/eclipse/collections/test/list/mutable/CompositeFastListTest.java +++ b/unit-tests-java8/src/test/java/org/eclipse/collections/test/list/mutable/CompositeFastListTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -25,7 +25,7 @@ public class CompositeFastListTest implements MutableListTestCase public final MutableList newWith(T... elements) { RichIterable> chunks = FastList.wrapCopy(elements).chunk(3); - CompositeFastList result = new CompositeFastList<>(); + MutableList result = new CompositeFastList<>(); for (RichIterable chunk : chunks) { result.addAll(FastList.newList(chunk)); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/bag/immutable/ImmutableSingletonBagTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/bag/immutable/ImmutableSingletonBagTest.java index 0391b2a83e..cc20a9810f 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/bag/immutable/ImmutableSingletonBagTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/bag/immutable/ImmutableSingletonBagTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -86,7 +86,7 @@ public void selectDuplicates() public void equalsAndHashCode() { super.equalsAndHashCode(); - ImmutableSingletonBag immutable = new ImmutableSingletonBag<>(1); + ImmutableBag immutable = new ImmutableSingletonBag<>(1); Bag mutable = Bags.mutable.of(1); Verify.assertEqualsAndHashCode(immutable, mutable); Assert.assertNotEquals(immutable, FastList.newList(mutable)); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/bag/mutable/primitive/SynchronizedBooleanBagTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/bag/mutable/primitive/SynchronizedBooleanBagTest.java index f8bf0eac33..8d6dacc278 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/bag/mutable/primitive/SynchronizedBooleanBagTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/bag/mutable/primitive/SynchronizedBooleanBagTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -38,7 +38,7 @@ protected SynchronizedBooleanBag newWith(boolean... elements) public void asSynchronized() { super.asSynchronized(); - SynchronizedBooleanBag bagWithLockObject = new SynchronizedBooleanBag(BooleanHashBag.newBagWith(true, false, true), new Object()); + MutableBooleanBag bagWithLockObject = new SynchronizedBooleanBag(BooleanHashBag.newBagWith(true, false, true), new Object()); Assert.assertSame(bagWithLockObject, bagWithLockObject.asSynchronized()); Assert.assertEquals(bagWithLockObject, bagWithLockObject.asSynchronized()); MutableBooleanBag bag = this.classUnderTest(); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/CheckedBlocksTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/CheckedBlocksTest.java index 99a5a889b7..149e823295 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/CheckedBlocksTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/CheckedBlocksTest.java @@ -14,6 +14,7 @@ import org.eclipse.collections.api.block.function.Function; import org.eclipse.collections.api.block.function.Function0; +import org.eclipse.collections.api.block.function.Function2; import org.eclipse.collections.api.block.predicate.Predicate; import org.eclipse.collections.api.block.predicate.Predicate2; import org.eclipse.collections.api.block.procedure.Procedure; @@ -47,7 +48,7 @@ public void checkedFunction2CheckedException() { Verify.assertThrowsWithCause(RuntimeException.class, IOException.class, () -> { - CheckedFunction2 block = + Function2 block = new CheckedFunction2() { @Override @@ -65,7 +66,7 @@ public void checkedFunction2RuntimeException() { Assert.assertThrows(LocalException.class, () -> { - CheckedFunction2 block = + Function2 block = new CheckedFunction2() { @Override @@ -83,7 +84,7 @@ public void checkedCodeBlockCheckedException() { Verify.assertThrowsWithCause(RuntimeException.class, IOException.class, () -> { - CheckedFunction0 function = new CheckedFunction0() + Function0 function = new CheckedFunction0() { @Override public String safeValue() throws IOException @@ -100,7 +101,7 @@ public void checkedCodeBlockRuntimeException() { Assert.assertThrows(LocalException.class, () -> { - CheckedFunction0 function = new CheckedFunction0() + Function0 function = new CheckedFunction0() { @Override public String safeValue() @@ -117,7 +118,7 @@ public void checkedProcedureCheckedException() { Verify.assertThrowsWithCause(RuntimeException.class, IOException.class, () -> { - CheckedProcedure block = new CheckedProcedure() + Procedure block = new CheckedProcedure() { @Override public void safeValue(String object) throws IOException @@ -134,7 +135,7 @@ public void checkedProcedureRuntimeException() { Assert.assertThrows(LocalException.class, () -> { - CheckedProcedure block = new CheckedProcedure() + Procedure block = new CheckedProcedure() { @Override public void safeValue(String object) @@ -151,7 +152,7 @@ public void checkedObjectIntProcedureCheckedException() { Verify.assertThrowsWithCause(RuntimeException.class, IOException.class, () -> { - CheckedObjectIntProcedure block = new CheckedObjectIntProcedure() + ObjectIntProcedure block = new CheckedObjectIntProcedure() { @Override public void safeValue(String object, int index) throws IOException @@ -168,7 +169,7 @@ public void checkedObjectIntProcedureRuntimeException() { Assert.assertThrows(LocalException.class, () -> { - CheckedObjectIntProcedure block = new CheckedObjectIntProcedure() + ObjectIntProcedure block = new CheckedObjectIntProcedure() { @Override public void safeValue(String object, int index) @@ -185,7 +186,7 @@ public void checkedFunctionCheckedException() { Verify.assertThrowsWithCause(RuntimeException.class, IOException.class, () -> { - CheckedFunction block = + Function block = new CheckedFunction() { @Override @@ -203,7 +204,7 @@ public void checkedFunctionRuntimeException() { Assert.assertThrows(LocalException.class, () -> { - CheckedFunction block = + Function block = new CheckedFunction() { @Override @@ -221,7 +222,7 @@ public void checkedPredicateCheckedException() { Verify.assertThrowsWithCause(RuntimeException.class, IOException.class, () -> { - CheckedPredicate block = new CheckedPredicate() + Predicate block = new CheckedPredicate() { @Override public boolean safeAccept(String object) throws IOException @@ -238,7 +239,7 @@ public void checkedPredicateRuntimeException() { Assert.assertThrows(LocalException.class, () -> { - CheckedPredicate block = new CheckedPredicate() + Predicate block = new CheckedPredicate() { @Override public boolean safeAccept(String object) @@ -255,7 +256,7 @@ public void checkedPredicate2CheckedException() { Verify.assertThrowsWithCause(RuntimeException.class, IOException.class, () -> { - CheckedPredicate2 block = + Predicate2 block = new CheckedPredicate2() { @Override @@ -273,7 +274,7 @@ public void checkedPredicate2RuntimeException() { Assert.assertThrows(LocalException.class, () -> { - CheckedPredicate2 block = + Predicate2 block = new CheckedPredicate2() { @Override @@ -291,7 +292,7 @@ public void checkedProcedure2CheckedException() { Verify.assertThrowsWithCause(RuntimeException.class, IOException.class, () -> { - CheckedProcedure2 block = new CheckedProcedure2() + Procedure2 block = new CheckedProcedure2() { @Override public void safeValue(String object, String parameter) throws IOException @@ -308,7 +309,7 @@ public void checkedProcedure2RuntimeException() { Assert.assertThrows(LocalException.class, () -> { - CheckedProcedure2 block = new CheckedProcedure2() + Procedure2 block = new CheckedProcedure2() { @Override public void safeValue(String object, String parameter) diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/comparator/FunctionComparatorTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/comparator/FunctionComparatorTest.java index 154a3d3763..3d5be39eeb 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/comparator/FunctionComparatorTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/comparator/FunctionComparatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -32,7 +32,7 @@ public class FunctionComparatorTest @Test public void comparator() { - FunctionComparator comparator = new FunctionComparator<>( + Comparator comparator = new FunctionComparator<>( Band.TO_NAME, String::compareTo); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/CaseFunctionTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/CaseFunctionTest.java index d1b4f7adfe..6c96a64712 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/CaseFunctionTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/CaseFunctionTest.java @@ -24,7 +24,7 @@ public class CaseFunctionTest @Test public void noopCase() { - CaseFunction function = new CaseFunction<>(); + Function function = new CaseFunction<>(); Assert.assertNull(function.valueOf(42)); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/IfFunctionTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/IfFunctionTest.java index 75642ad72a..3c84c0c90e 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/IfFunctionTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/IfFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,6 +10,7 @@ package org.eclipse.collections.impl.block.function; +import org.eclipse.collections.api.block.function.Function; import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.impl.block.factory.IntegerPredicates; import org.eclipse.collections.impl.block.factory.Predicates; @@ -30,7 +31,7 @@ public void iterate() map.put(4, 4); map.put(5, 5); - IfFunction function = new IfFunction<>( + Function function = new IfFunction<>( IntegerPredicates.isEven(), (Integer ignored) -> 1, (Integer ignored) -> 0); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/primitive/BooleanCaseFunctionTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/primitive/BooleanCaseFunctionTest.java index e3df1a09fd..20fe25ac6e 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/primitive/BooleanCaseFunctionTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/function/primitive/BooleanCaseFunctionTest.java @@ -10,6 +10,7 @@ package org.eclipse.collections.impl.block.function.primitive; +import org.eclipse.collections.api.block.function.primitive.BooleanToObjectFunction; import org.eclipse.collections.impl.test.Verify; import org.junit.Assert; import org.junit.Test; @@ -19,7 +20,7 @@ public class BooleanCaseFunctionTest @Test public void noopCase() { - BooleanCaseFunction function = new BooleanCaseFunction<>(); + BooleanToObjectFunction function = new BooleanCaseFunction<>(); Assert.assertNull(function.valueOf(true)); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/AdaptObjectIntProcedureToProcedureTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/AdaptObjectIntProcedureToProcedureTest.java index 251f081e30..ee89197e5a 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/AdaptObjectIntProcedureToProcedureTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/AdaptObjectIntProcedureToProcedureTest.java @@ -10,6 +10,7 @@ package org.eclipse.collections.impl.block.procedure; +import org.eclipse.collections.api.block.procedure.Procedure; import org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure; import org.junit.Assert; import org.junit.Test; @@ -20,7 +21,7 @@ public class AdaptObjectIntProcedureToProcedureTest public void value() { MockObjectIntProcedure mockObjectIntProcedure = new MockObjectIntProcedure(); - AdaptObjectIntProcedureToProcedure procedure = + Procedure procedure = new AdaptObjectIntProcedureToProcedure<>(mockObjectIntProcedure); procedure.value(1); Assert.assertEquals(1, mockObjectIntProcedure.getEachValue()); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/AtomicCountProcedureTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/AtomicCountProcedureTest.java index 59d48e4b29..3a45b39f9d 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/AtomicCountProcedureTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/AtomicCountProcedureTest.java @@ -10,6 +10,7 @@ package org.eclipse.collections.impl.block.procedure; +import org.eclipse.collections.api.block.procedure.Procedure; import org.eclipse.collections.impl.list.Interval; import org.junit.Test; @@ -35,7 +36,7 @@ public void getCount() @Test(expected = ArithmeticException.class) public void predicateException() { - AtomicCountProcedure atomicCountProcedure = new AtomicCountProcedure<>(each -> STRING_LENGTH < each.length() / ZERO); + Procedure atomicCountProcedure = new AtomicCountProcedure<>(each -> STRING_LENGTH < each.length() / ZERO); atomicCountProcedure.value("word"); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/checked/MultimapKeyValuesSerializingProcedureTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/checked/MultimapKeyValuesSerializingProcedureTest.java index 07122dd9a5..5a5a7b248f 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/checked/MultimapKeyValuesSerializingProcedureTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/checked/MultimapKeyValuesSerializingProcedureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -14,6 +14,8 @@ import java.io.Serializable; import java.util.Iterator; +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.block.procedure.Procedure2; import org.eclipse.collections.impl.list.mutable.FastList; import org.eclipse.collections.impl.multimap.list.FastListMultimap; import org.junit.Assert; @@ -28,7 +30,7 @@ public void testSerialization() map.put("A", "alpha"); map.put("A", "beta"); FastList expectedWrites = FastList.newListWith("A", 2, "alpha", "beta"); - MultimapKeyValuesSerializingProcedure procedure = + Procedure2> procedure = new MultimapKeyValuesSerializingProcedure<>(new MockObjectOutput(expectedWrites)); map.toMap().forEachKeyValue(procedure); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/checked/primitive/CheckedBooleanIntProcedureTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/checked/primitive/CheckedBooleanIntProcedureTest.java index 6ebf024cd0..87e8ae0001 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/checked/primitive/CheckedBooleanIntProcedureTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/checked/primitive/CheckedBooleanIntProcedureTest.java @@ -12,6 +12,7 @@ import java.io.IOException; +import org.eclipse.collections.api.block.procedure.primitive.BooleanIntProcedure; import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.api.tuple.primitive.BooleanIntPair; @@ -25,7 +26,7 @@ public class CheckedBooleanIntProcedureTest public void value() { MutableList list = Lists.mutable.empty(); - CheckedBooleanIntProcedure procedure = new CheckedBooleanIntProcedure() + BooleanIntProcedure procedure = new CheckedBooleanIntProcedure() { @Override public void safeValue(boolean item1, int item2) diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/primitive/CollectBooleanProcedureTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/primitive/CollectBooleanProcedureTest.java index 639c82efc5..effb45d41c 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/primitive/CollectBooleanProcedureTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/block/procedure/primitive/CollectBooleanProcedureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -11,6 +11,7 @@ package org.eclipse.collections.impl.block.procedure.primitive; import org.eclipse.collections.api.block.function.primitive.BooleanFunction; +import org.eclipse.collections.api.block.procedure.Procedure; import org.eclipse.collections.api.list.primitive.ImmutableBooleanList; import org.eclipse.collections.api.list.primitive.MutableBooleanList; import org.eclipse.collections.impl.factory.primitive.BooleanLists; @@ -24,7 +25,7 @@ public void basicCase() { BooleanFunction stringIsEmptyFunction = String::isEmpty; MutableBooleanList targetList = BooleanLists.mutable.empty(); - CollectBooleanProcedure procedure = new CollectBooleanProcedure(stringIsEmptyFunction, targetList); + Procedure procedure = new CollectBooleanProcedure<>(stringIsEmptyFunction, targetList); procedure.value(""); procedure.value("0"); procedure.value("00"); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/iterator/SingletonBooleanIteratorTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/iterator/SingletonBooleanIteratorTest.java index 0a6f30590c..fd2a5ce721 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/iterator/SingletonBooleanIteratorTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/iterator/SingletonBooleanIteratorTest.java @@ -12,6 +12,7 @@ import java.util.NoSuchElementException; +import org.eclipse.collections.api.iterator.BooleanIterator; import org.junit.Assert; import org.junit.Test; @@ -20,7 +21,7 @@ public class SingletonBooleanIteratorTest @Test public void hasNext() { - SingletonBooleanIterator iterator = new SingletonBooleanIterator(false); + BooleanIterator iterator = new SingletonBooleanIterator(false); Assert.assertTrue(iterator.hasNext()); Assert.assertTrue(iterator.hasNext()); iterator.next(); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/CollectIterableTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/CollectIterableTest.java index 5a9abdee54..0b9b4a71ea 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/CollectIterableTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/CollectIterableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -12,7 +12,6 @@ import java.util.concurrent.atomic.AtomicInteger; -import org.eclipse.collections.api.InternalIterable; import org.eclipse.collections.api.LazyIterable; import org.eclipse.collections.api.block.procedure.Procedure; import org.eclipse.collections.api.list.MultiReaderList; @@ -36,7 +35,7 @@ protected LazyIterable newWith(T... elements) @Test public void forEach() { - InternalIterable select = new CollectIterable<>(Interval.oneTo(5), String::valueOf); + LazyIterable select = new CollectIterable<>(Interval.oneTo(5), String::valueOf); Appendable builder = new StringBuilder(); Procedure appendProcedure = Procedures.append(builder); select.forEach(appendProcedure); @@ -46,7 +45,7 @@ public void forEach() @Test public void forEachWithIndex() { - InternalIterable select = new CollectIterable<>(Interval.oneTo(5), String::valueOf); + LazyIterable select = new CollectIterable<>(Interval.oneTo(5), String::valueOf); StringBuilder builder = new StringBuilder(); select.forEachWithIndex((object, index) -> { builder.append(object); @@ -59,7 +58,7 @@ public void forEachWithIndex() @Test public void iterator() { - InternalIterable select = new CollectIterable<>(Interval.oneTo(5), String::valueOf); + LazyIterable select = new CollectIterable<>(Interval.oneTo(5), String::valueOf); StringBuilder builder = new StringBuilder(); for (String each : select) { @@ -71,7 +70,7 @@ public void iterator() @Test public void forEachWith() { - InternalIterable select = new CollectIterable<>(Interval.oneTo(5), String::valueOf); + LazyIterable select = new CollectIterable<>(Interval.oneTo(5), String::valueOf); StringBuilder builder = new StringBuilder(); select.forEachWith((each, aBuilder) -> aBuilder.append(each), builder); Assert.assertEquals("12345", builder.toString()); @@ -82,7 +81,7 @@ public void forEachWith() public void distinct() { super.distinct(); - CollectIterable collect = new CollectIterable<>(FastList.newListWith(3, 2, 2, 4, 1, 3, 1, 5), String::valueOf); + LazyIterable collect = new CollectIterable<>(FastList.newListWith(3, 2, 2, 4, 1, 3, 1, 5), String::valueOf); Assert.assertEquals( FastList.newListWith("3", "2", "4", "1", "5"), collect.distinct().toList()); @@ -174,7 +173,7 @@ public void detectWith() super.detectWith(); AtomicInteger functionCount = new AtomicInteger(0); MultiReaderList integers = Lists.multiReader.withAll(Interval.oneTo(5)); - CollectIterable collect = new CollectIterable<>(integers, functionCount::addAndGet); + LazyIterable collect = new CollectIterable<>(integers, functionCount::addAndGet); Assert.assertEquals(3L, collect.detectWith((each, ignore) -> each.equals(3), null).longValue()); Assert.assertNull(collect.detectWith((each, ignore) -> each.equals(100), null)); } @@ -186,7 +185,7 @@ public void detectWithIfNone() super.detectWithIfNone(); AtomicInteger functionCount = new AtomicInteger(0); MultiReaderList integers = Lists.multiReader.withAll(Interval.oneTo(5)); - CollectIterable collect = new CollectIterable<>(integers, functionCount::addAndGet); + LazyIterable collect = new CollectIterable<>(integers, functionCount::addAndGet); Assert.assertEquals(3L, collect.detectWithIfNone((each, ignore) -> each.equals(3), null, () -> Integer.valueOf(0)).longValue()); Assert.assertNull(collect.detectWithIfNone((each, ignore) -> each.equals(100), null, () -> null)); } @@ -210,9 +209,8 @@ public void detectWithOptional() super.detectWithOptional(); AtomicInteger functionCount = new AtomicInteger(0); MultiReaderList integers = Lists.multiReader.withAll(Interval.oneTo(5)); - CollectIterable collect = new CollectIterable<>(integers, functionCount::addAndGet); + LazyIterable collect = new CollectIterable<>(integers, functionCount::addAndGet); Assert.assertEquals(3L, collect.detectWithOptional((each, ignore) -> each.equals(3), null).get().longValue()); Assert.assertNull(collect.detectWithOptional((each, ignore) -> each.equals(100), null).orElse(null)); } } - diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/DistinctIterableTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/DistinctIterableTest.java index 56f3c90f70..98dba1cc02 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/DistinctIterableTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/DistinctIterableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -12,7 +12,6 @@ import java.util.NoSuchElementException; -import org.eclipse.collections.api.InternalIterable; import org.eclipse.collections.api.LazyIterable; import org.eclipse.collections.api.block.procedure.Procedure; import org.eclipse.collections.impl.block.factory.Procedures; @@ -34,7 +33,7 @@ protected LazyIterable newWith(T... elements) @Test public void forEach() { - InternalIterable distinct = new DistinctIterable<>(FastList.newListWith(3, 1, 2, 2, 3, 4)); + LazyIterable distinct = new DistinctIterable<>(FastList.newListWith(3, 1, 2, 2, 3, 4)); Appendable builder = new StringBuilder(); Procedure appendProcedure = Procedures.append(builder); distinct.forEach(appendProcedure); @@ -44,7 +43,7 @@ public void forEach() @Test public void forEachWithIndex() { - InternalIterable distinct = new DistinctIterable<>(FastList.newListWith(1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9)); + LazyIterable distinct = new DistinctIterable<>(FastList.newListWith(1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9)); StringBuilder builder = new StringBuilder(); distinct.forEachWithIndex((object, index) -> { builder.append(object); @@ -57,7 +56,7 @@ public void forEachWithIndex() @Test public void iterator() { - InternalIterable distinct = new DistinctIterable<>(FastList.newListWith(3, 1, 2, 2, 3, 4, 2, 5)); + LazyIterable distinct = new DistinctIterable<>(FastList.newListWith(3, 1, 2, 2, 3, 4, 2, 5)); StringBuilder builder = new StringBuilder(); for (Integer each : distinct) { @@ -69,7 +68,7 @@ public void iterator() @Test public void forEachWith() { - InternalIterable distinct = new DistinctIterable<>(FastList.newListWith(1, 3, 3, 2, 5, 4, 2, 5, 4)); + LazyIterable distinct = new DistinctIterable<>(FastList.newListWith(1, 3, 3, 2, 5, 4, 2, 5, 4)); StringBuilder builder = new StringBuilder(); distinct.forEachWith((each, aBuilder) -> aBuilder.append(each), builder); Assert.assertEquals("13254", builder.toString()); @@ -92,7 +91,7 @@ public void remove() public void distinct() { super.distinct(); - DistinctIterable distinct = new DistinctIterable<>(FastList.newListWith(3, 2, 2, 4, 1, 3, 1, 5)); + LazyIterable distinct = new DistinctIterable<>(FastList.newListWith(3, 2, 2, 4, 1, 3, 1, 5)); LazyIterable distinctDistinct = distinct.distinct(); Assert.assertSame(distinctDistinct, distinct); Assert.assertEquals( diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/FlatCollectIterableTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/FlatCollectIterableTest.java index 48ead8eee0..42708201c8 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/FlatCollectIterableTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/FlatCollectIterableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,7 +10,6 @@ package org.eclipse.collections.impl.lazy; -import org.eclipse.collections.api.InternalIterable; import org.eclipse.collections.api.LazyIterable; import org.eclipse.collections.api.block.procedure.Procedure; import org.eclipse.collections.impl.block.factory.Procedures; @@ -31,7 +30,7 @@ protected LazyIterable newWith(T... elements) @Test public void forEach() { - InternalIterable select = new FlatCollectIterable<>(Interval.oneTo(5), Interval::oneTo); + LazyIterable select = new FlatCollectIterable<>(Interval.oneTo(5), Interval::oneTo); Appendable builder = new StringBuilder(); Procedure appendProcedure = Procedures.append(builder); select.forEach(appendProcedure); @@ -41,7 +40,7 @@ public void forEach() @Test public void forEachWithIndex() { - InternalIterable select = new FlatCollectIterable<>(Interval.oneTo(5), Interval::oneTo); + LazyIterable select = new FlatCollectIterable<>(Interval.oneTo(5), Interval::oneTo); StringBuilder builder = new StringBuilder(); select.forEachWithIndex((object, index) -> { builder.append(object); @@ -54,7 +53,7 @@ public void forEachWithIndex() @Test public void iterator() { - InternalIterable select = new FlatCollectIterable<>(Interval.oneTo(5), Interval::oneTo); + LazyIterable select = new FlatCollectIterable<>(Interval.oneTo(5), Interval::oneTo); StringBuilder builder = new StringBuilder(); for (Integer each : select) { @@ -66,7 +65,7 @@ public void iterator() @Test public void forEachWith() { - InternalIterable select = new FlatCollectIterable<>(Interval.oneTo(5), Interval::oneTo); + LazyIterable select = new FlatCollectIterable<>(Interval.oneTo(5), Interval::oneTo); StringBuilder builder = new StringBuilder(); select.forEachWith((each, aBuilder) -> aBuilder.append(each), builder); Assert.assertEquals("112123123412345", builder.toString()); @@ -77,7 +76,7 @@ public void forEachWith() public void distinct() { super.distinct(); - FlatCollectIterable iterable = new FlatCollectIterable<>(FastList.newListWith(3, 2, 2, 4, 1, 3, 1, 5), Interval::oneTo); + LazyIterable iterable = new FlatCollectIterable<>(FastList.newListWith(3, 2, 2, 4, 1, 3, 1, 5), Interval::oneTo); Assert.assertEquals( FastList.newListWith(1, 2, 3, 4, 5), iterable.distinct().toList()); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/RejectIterableTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/RejectIterableTest.java index e65e64d3a3..3b4a16dc95 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/RejectIterableTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/RejectIterableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,7 +10,6 @@ package org.eclipse.collections.impl.lazy; -import org.eclipse.collections.api.InternalIterable; import org.eclipse.collections.api.LazyIterable; import org.eclipse.collections.impl.block.factory.Predicates; import org.eclipse.collections.impl.list.Interval; @@ -33,7 +32,7 @@ protected LazyIterable newWith(T... elements) @Test public void forEach() { - InternalIterable select = new RejectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); + LazyIterable select = new RejectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); Sum sum = new IntegerSum(0); select.forEach(new SumProcedure<>(sum)); Assert.assertEquals(5, sum.getValue().intValue()); @@ -42,7 +41,7 @@ public void forEach() @Test public void forEachWithIndex() { - InternalIterable select = new RejectIterable<>(Interval.oneTo(5), Predicates.lessThan(2).or(Predicates.greaterThan(3))); + LazyIterable select = new RejectIterable<>(Interval.oneTo(5), Predicates.lessThan(2).or(Predicates.greaterThan(3))); Sum sum = new IntegerSum(0); select.forEachWithIndex((object, index) -> { sum.add(object); @@ -55,7 +54,7 @@ public void forEachWithIndex() @Test public void iterator() { - InternalIterable select = new RejectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); + LazyIterable select = new RejectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); Sum sum = new IntegerSum(0); for (Integer each : select) { @@ -67,7 +66,7 @@ public void iterator() @Test public void forEachWith() { - InternalIterable select = new RejectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); + LazyIterable select = new RejectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); Sum sum = new IntegerSum(0); select.forEachWith((each, aSum) -> aSum.add(each), sum); Assert.assertEquals(5, sum.getValue().intValue()); @@ -78,7 +77,7 @@ public void forEachWith() public void distinct() { super.distinct(); - RejectIterable iterable = new RejectIterable<>(FastList.newListWith(3, 2, 2, 4, 1, 3, 1, 5), Predicates.lessThan(2)); + LazyIterable iterable = new RejectIterable<>(FastList.newListWith(3, 2, 2, 4, 1, 3, 1, 5), Predicates.lessThan(2)); Assert.assertEquals( FastList.newListWith(3, 2, 4, 5), iterable.distinct().toList()); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/SelectInstancesOfIterableTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/SelectInstancesOfIterableTest.java index 07606bf9fa..da963776b7 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/SelectInstancesOfIterableTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/SelectInstancesOfIterableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,7 +10,6 @@ package org.eclipse.collections.impl.lazy; -import org.eclipse.collections.api.InternalIterable; import org.eclipse.collections.api.LazyIterable; import org.eclipse.collections.impl.list.mutable.FastList; import org.eclipse.collections.impl.math.IntegerSum; @@ -35,7 +34,7 @@ protected LazyIterable newWith(T... elements) @Test public void forEach() { - InternalIterable select = new SelectInstancesOfIterable<>(FastList.newListWith(1, 2.0, 3, 4.0, 5), Integer.class); + LazyIterable select = new SelectInstancesOfIterable<>(FastList.newListWith(1, 2.0, 3, 4.0, 5), Integer.class); Sum sum = new IntegerSum(0); select.forEach(new SumProcedure<>(sum)); Assert.assertEquals(9, sum.getValue().intValue()); @@ -44,7 +43,7 @@ public void forEach() @Test public void forEachWithIndex() { - InternalIterable select = new SelectInstancesOfIterable<>(FastList.newListWith(1, 2.0, 3, 4.0, 5), Integer.class); + LazyIterable select = new SelectInstancesOfIterable<>(FastList.newListWith(1, 2.0, 3, 4.0, 5), Integer.class); Sum sum = new IntegerSum(0); select.forEachWithIndex((object, index) -> { sum.add(object); @@ -59,7 +58,7 @@ public void forEachWithIndex() @Test public void iterator() { - InternalIterable select = new SelectInstancesOfIterable<>(FastList.newListWith(1, 2.0, 3, 4.0, 5), Integer.class); + LazyIterable select = new SelectInstancesOfIterable<>(FastList.newListWith(1, 2.0, 3, 4.0, 5), Integer.class); Sum sum = new IntegerSum(0); for (Integer each : select) { @@ -71,7 +70,7 @@ public void iterator() @Test public void forEachWith() { - InternalIterable select = new SelectInstancesOfIterable<>(FastList.newListWith(1, 2.0, 3, 4.0, 5), Integer.class); + LazyIterable select = new SelectInstancesOfIterable<>(FastList.newListWith(1, 2.0, 3, 4.0, 5), Integer.class); Sum sum = new IntegerSum(0); select.forEachWith((each, aSum) -> aSum.add(each), sum); Assert.assertEquals(9, sum.getValue().intValue()); @@ -114,7 +113,7 @@ public void max_null_throws_without_comparator() public void distinct() { super.distinct(); - SelectInstancesOfIterable iterable = new SelectInstancesOfIterable<>(FastList.newListWith(3.0, 2.0, 3, 2.0, 4.0, 5, 1.0, 3.0, 1.0, 5.0), Double.class); + LazyIterable iterable = new SelectInstancesOfIterable<>(FastList.newListWith(3.0, 2.0, 3, 2.0, 4.0, 5, 1.0, 3.0, 1.0, 5.0), Double.class); Assert.assertEquals( FastList.newListWith(3.0, 2.0, 4.0, 1.0, 5.0), iterable.distinct().toList()); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/SelectIterableTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/SelectIterableTest.java index aedd9debbe..6f8d0baf75 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/SelectIterableTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/SelectIterableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,7 +10,6 @@ package org.eclipse.collections.impl.lazy; -import org.eclipse.collections.api.InternalIterable; import org.eclipse.collections.api.LazyIterable; import org.eclipse.collections.impl.block.factory.Predicates; import org.eclipse.collections.impl.list.Interval; @@ -37,7 +36,7 @@ protected LazyIterable newWith(T... elements) @Test public void forEach() { - InternalIterable select = new SelectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); + LazyIterable select = new SelectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); Sum sum = new IntegerSum(0); select.forEach(new SumProcedure<>(sum)); Assert.assertEquals(10, sum.getValue().intValue()); @@ -46,7 +45,7 @@ public void forEach() @Test public void forEachWithIndex() { - InternalIterable select = new SelectIterable<>(Interval.oneTo(5), Predicates.lessThan(2).or(Predicates.greaterThan(3))); + LazyIterable select = new SelectIterable<>(Interval.oneTo(5), Predicates.lessThan(2).or(Predicates.greaterThan(3))); Sum sum = new IntegerSum(0); select.forEachWithIndex((object, index) -> { sum.add(object); @@ -61,7 +60,7 @@ public void forEachWithIndex() @Test public void iterator() { - InternalIterable select = new SelectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); + LazyIterable select = new SelectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); Sum sum = new IntegerSum(0); for (Integer each : select) { @@ -73,7 +72,7 @@ public void iterator() @Test public void forEachWith() { - InternalIterable select = new SelectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); + LazyIterable select = new SelectIterable<>(Interval.oneTo(5), Predicates.lessThan(5)); Sum sum = new IntegerSum(0); select.forEachWith((each, aSum) -> aSum.add(each), sum); Assert.assertEquals(10, sum.getValue().intValue()); @@ -84,7 +83,7 @@ public void forEachWith() public void distinct() { super.distinct(); - SelectIterable iterable = new SelectIterable<>(FastList.newListWith(5, 3, 2, 2, 4, 1, 3, 1, 5), Predicates.lessThan(5)); + LazyIterable iterable = new SelectIterable<>(FastList.newListWith(5, 3, 2, 2, 4, 1, 3, 1, 5), Predicates.lessThan(5)); Assert.assertEquals( FastList.newListWith(3, 2, 4, 1), iterable.distinct().toList()); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/TapIterableTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/TapIterableTest.java index d9b76cc6c1..23046eda64 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/TapIterableTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/TapIterableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,7 +10,6 @@ package org.eclipse.collections.impl.lazy; -import org.eclipse.collections.api.InternalIterable; import org.eclipse.collections.api.LazyIterable; import org.eclipse.collections.api.block.procedure.Procedure; import org.eclipse.collections.impl.block.factory.Procedures; @@ -36,7 +35,7 @@ public void forEach() StringBuilder builder = new StringBuilder(); Procedure appendProcedure = Procedures.append(builder); - InternalIterable tap = new TapIterable<>(Interval.oneTo(5), appendProcedure); + LazyIterable tap = new TapIterable<>(Interval.oneTo(5), appendProcedure); Procedure appendDouble = each -> builder.append(each * 2); tap.forEach(appendDouble); Assert.assertEquals("12243648510", builder.toString()); @@ -47,7 +46,7 @@ public void forEachWithIndex() { StringBuilder builder = new StringBuilder(); Procedure appendProcedure = Procedures.append(builder); - InternalIterable tap = new TapIterable<>(Interval.oneTo(5), appendProcedure); + LazyIterable tap = new TapIterable<>(Interval.oneTo(5), appendProcedure); tap.forEachWithIndex((each, index) -> { builder.append(each * 2); builder.append(index); @@ -61,7 +60,7 @@ public void iterator() { StringBuilder builder = new StringBuilder(); Procedure appendProcedure = Procedures.append(builder); - InternalIterable tap = new TapIterable<>(Interval.oneTo(5), appendProcedure); + LazyIterable tap = new TapIterable<>(Interval.oneTo(5), appendProcedure); for (Integer each : tap) { builder.append(each + 1); @@ -74,7 +73,7 @@ public void forEachWith() { StringBuilder builder = new StringBuilder(); Procedure appendProcedure = Procedures.append(builder); - InternalIterable tap = new TapIterable<>(Interval.oneTo(5), appendProcedure); + LazyIterable tap = new TapIterable<>(Interval.oneTo(5), appendProcedure); tap.forEachWith((each, aBuilder) -> aBuilder.append(each - 1), builder); Assert.assertEquals("1021324354", builder.toString()); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/DistinctIteratorTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/DistinctIteratorTest.java index 405f814377..8022d1d284 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/DistinctIteratorTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/DistinctIteratorTest.java @@ -10,6 +10,7 @@ package org.eclipse.collections.impl.lazy.iterator; +import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; @@ -45,7 +46,7 @@ public void iterator() @Test(expected = NoSuchElementException.class) public void nextException() { - DistinctIterator iterator = new DistinctIterator(Lists.mutable.empty()); + Iterator iterator = new DistinctIterator<>(Lists.mutable.empty()); Assert.assertFalse(iterator.hasNext()); iterator.next(); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/FlatCollectIteratorTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/FlatCollectIteratorTest.java index 908ce0f130..9d334f45ad 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/FlatCollectIteratorTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/FlatCollectIteratorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,7 +10,7 @@ package org.eclipse.collections.impl.lazy.iterator; -import java.util.List; +import java.util.Iterator; import java.util.NoSuchElementException; import org.eclipse.collections.impl.block.factory.Functions; @@ -36,7 +36,7 @@ public void removeIsUnsupported() public void nextAfterEmptyIterable() { Object expected = new Object(); - FlatCollectIterator, Object> flattenIterator = new FlatCollectIterator<>( + Iterator flattenIterator = new FlatCollectIterator<>( Lists.fixedSize.of( Lists.fixedSize.of(), Lists.fixedSize.of(expected)), diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/TapIteratorTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/TapIteratorTest.java index 2e63e9f53e..b49447805a 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/TapIteratorTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/iterator/TapIteratorTest.java @@ -10,6 +10,7 @@ package org.eclipse.collections.impl.lazy.iterator; +import java.util.Iterator; import java.util.NoSuchElementException; import java.util.concurrent.atomic.AtomicInteger; @@ -39,7 +40,7 @@ public void removeIsUnsupported() public void nextAfterEmptyIterable() { Object expected = new Object(); - TapIterator iterator = new TapIterator<>( + Iterator iterator = new TapIterator<>( Lists.fixedSize.of(expected), object -> { }); Assert.assertSame(expected, iterator.next()); } @@ -47,8 +48,8 @@ public void nextAfterEmptyIterable() @Test public void iterator() { - TapIterator iterator = - new TapIterator( + Iterator iterator = + new TapIterator<>( Lists.mutable.of( new AtomicInteger(1), new AtomicInteger(2), diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/primitive/TapBooleanIterableTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/primitive/TapBooleanIterableTest.java index 48656cc740..78fce6c8ec 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/primitive/TapBooleanIterableTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/lazy/primitive/TapBooleanIterableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -10,6 +10,7 @@ package org.eclipse.collections.impl.lazy.primitive; +import org.eclipse.collections.api.LazyBooleanIterable; import org.eclipse.collections.api.iterator.BooleanIterator; import org.eclipse.collections.api.list.primitive.BooleanList; import org.eclipse.collections.impl.block.factory.primitive.BooleanPredicates; @@ -26,7 +27,7 @@ public class TapBooleanIterableTest public void booleanIterator() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); for (BooleanIterator iterator = iterable.booleanIterator(); iterator.hasNext(); ) { @@ -39,7 +40,7 @@ public void booleanIterator() public void forEach() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); iterable.forEach(each -> { }); Assert.assertEquals("truefalsefalsetrue", concat.toString()); @@ -60,7 +61,7 @@ public void injectInto() public void size() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); Assert.assertEquals(4L, iterable.size()); Assert.assertEquals("truefalsefalsetrue", concat.toString()); @@ -70,7 +71,7 @@ public void size() public void empty() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); Assert.assertTrue(iterable.notEmpty()); Assert.assertFalse(iterable.isEmpty()); @@ -80,7 +81,7 @@ public void empty() public void count() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); Assert.assertEquals(2L, iterable.count(BooleanPredicates.isTrue())); Assert.assertEquals(2L, iterable.count(BooleanPredicates.isFalse())); @@ -111,7 +112,7 @@ public void allSatisfy() public void select() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); Assert.assertEquals(2L, iterable.select(BooleanPredicates.isFalse()).size()); Assert.assertEquals(2L, iterable.select(BooleanPredicates.equal(true)).size()); @@ -122,7 +123,7 @@ public void select() public void reject() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); Assert.assertEquals(2L, iterable.reject(BooleanPredicates.isFalse()).size()); Assert.assertEquals(2L, iterable.reject(BooleanPredicates.equal(true)).size()); @@ -143,7 +144,7 @@ public void detectIfNone() public void collect() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); Assert.assertEquals(4L, iterable.collect(String::valueOf).size()); Assert.assertEquals("truefalsefalsetrue", concat.toString()); @@ -153,7 +154,7 @@ public void collect() public void toArray() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); Assert.assertEquals(4L, iterable.toArray().length); Assert.assertTrue(iterable.toArray()[0]); @@ -164,7 +165,7 @@ public void toArray() public void contains() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); Assert.assertTrue(iterable.contains(true)); Assert.assertTrue(iterable.contains(false)); @@ -174,7 +175,7 @@ public void contains() public void containsAll() { StringBuilder concat = new StringBuilder(); - TapBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); + LazyBooleanIterable iterable = new TapBooleanIterable(this.list, concat::append); Assert.assertTrue(iterable.containsAll(true, true)); Assert.assertTrue(iterable.containsAll(false, true)); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/list/IntervalTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/list/IntervalTest.java index 90bcbcc8bd..91664c5c08 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/list/IntervalTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/list/IntervalTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -414,10 +414,10 @@ public void invalidIntervals() } @Test - public void toFastList() + public void toList() { Interval interval = Interval.evensFromTo(0, 10); - FastList toList = (FastList) interval.toList(); + MutableList toList = interval.toList(); Verify.assertStartsWith(toList, 0, 2, 4, 6, 8, 10); Verify.assertSize(6, toList); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/list/immutable/primitive/AbstractImmutableBooleanListTestCase.java b/unit-tests/src/test/java/org/eclipse/collections/impl/list/immutable/primitive/AbstractImmutableBooleanListTestCase.java index 2c4ccd4fe4..5f481f794d 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/list/immutable/primitive/AbstractImmutableBooleanListTestCase.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/list/immutable/primitive/AbstractImmutableBooleanListTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -54,7 +54,7 @@ protected MutableList newObjectCollectionWith(Object... elements) @Test public void newWithOn64ElementCollection() { - BooleanArrayList sixtyFourElementCollection = new BooleanArrayList(); + MutableBooleanList sixtyFourElementCollection = new BooleanArrayList(); for (int i = 0; i < 64; i++) { sixtyFourElementCollection.add(true); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/AbstractListTestCase.java b/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/AbstractListTestCase.java index c3e2673a2d..39b890c3f1 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/AbstractListTestCase.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/AbstractListTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -1187,7 +1187,7 @@ public void forEachWithIndex() super.forEachWithIndex(); MutableList elements = FastList.newList(); - IntArrayList indexes = new IntArrayList(); + MutableIntList indexes = new IntArrayList(); MutableList collection = this.newWith(1, 2, 3, 4); collection.forEachWithIndex((Integer object, int index) -> { diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/CompositeFastListTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/CompositeFastListTest.java index cd15852791..fb9f8ca3a9 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/CompositeFastListTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/CompositeFastListTest.java @@ -32,7 +32,7 @@ public class CompositeFastListTest extends AbstractListTestCase @Override protected MutableList newWith(T... littleElements) { - CompositeFastList result = new CompositeFastList<>(); + MutableList result = new CompositeFastList<>(); for (T element : littleElements) { result.add(element); @@ -217,7 +217,7 @@ public void set() @Test public void set_bugFix_off_by_one_error() { - CompositeFastList compositeList = new CompositeFastList<>(); + MutableList compositeList = new CompositeFastList<>(); MutableList list1 = FastList.newListWith(1, 2, 3); MutableList list2 = FastList.newListWith(4, 5); MutableList list3 = FastList.newList(); @@ -383,7 +383,7 @@ public void testEquals() MutableList list2 = FastList.newListWith("one", "two", "three"); - CompositeFastList composite2 = new CompositeFastList<>(); + MutableList composite2 = new CompositeFastList<>(); MutableList firstBit = FastList.newListWith("one", "two"); MutableList secondBit = FastList.newListWith("three"); composite2.addAll(firstBit); @@ -414,7 +414,7 @@ public void testHashCode() MutableList list2 = FastList.newListWith("one", "two", "three"); - CompositeFastList composite2 = new CompositeFastList<>(); + MutableList composite2 = new CompositeFastList<>(); MutableList firstBit = FastList.newListWith("one", "two"); MutableList secondBit = FastList.newListWith("three"); composite2.addAll(firstBit); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/FastListTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/FastListTest.java index 408bf5e1e1..6f6c66426d 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/FastListTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/FastListTest.java @@ -803,7 +803,7 @@ public void addAtIndex() @Test public void testSubListSort() { - FastList list = (FastList) Interval.from(0).to(20).toList(); + MutableList list = new FastList<>(Interval.from(0).to(20)); MutableList sorted = list.subList(2, 18).sortThis(); Verify.assertListsEqual(sorted, Interval.from(2).to(17)); } @@ -1137,7 +1137,7 @@ public void testLazyCollectForEach() @Test public void testLazyFlattenForEach() { - FastList list = (FastList) Interval.oneTo(5).toList(); + MutableList list = new FastList<>(Interval.oneTo(5)); LazyIterable select = LazyIterate.flatCollect( list, object -> this.newWith(String.valueOf(object))); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/primitive/BooleanArrayListTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/primitive/BooleanArrayListTest.java index 05ae30f2ab..8ab68310de 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/primitive/BooleanArrayListTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/list/mutable/primitive/BooleanArrayListTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -41,7 +41,7 @@ protected BooleanArrayList newWith(boolean... elements) @Test public void testBooleanArrayListWithInitialCapacity() throws Exception { - BooleanArrayList arrayList = new BooleanArrayList(7); + MutableBooleanList arrayList = new BooleanArrayList(7); Verify.assertEmpty(arrayList); Field items = BooleanArrayList.class.getDeclaredField("items"); items.setAccessible(true); @@ -55,7 +55,7 @@ public void testBooleanArrayListWithInitialCapacity() throws Exception @Test public void addAtIndexAtCapacity() throws Exception { - BooleanArrayList listWithCapacity = new BooleanArrayList(64); + MutableBooleanList listWithCapacity = new BooleanArrayList(64); for (int i = 0; i < 64; i++) { listWithCapacity.add((i & 1) == 0); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/map/mutable/MutableMapIterableTestCase.java b/unit-tests/src/test/java/org/eclipse/collections/impl/map/mutable/MutableMapIterableTestCase.java index f75af098f1..be7ca9e347 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/map/mutable/MutableMapIterableTestCase.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/map/mutable/MutableMapIterableTestCase.java @@ -319,7 +319,7 @@ public void putAll() //Testing JDK map MutableMapIterable map2 = this.newMapWithKeysValues(1, "One", 2, "2"); - HashMap hashMaptoAdd = new HashMap<>(toAdd); + Map hashMaptoAdd = new HashMap<>(toAdd); map2.putAll(hashMaptoAdd); Verify.assertSize(3, map2); Verify.assertContainsAllKeyValues(map2, 1, "One", 2, "Two", 3, "Three"); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/map/mutable/UnifiedMapTestCase.java b/unit-tests/src/test/java/org/eclipse/collections/impl/map/mutable/UnifiedMapTestCase.java index 15c969ff2b..99395bb7eb 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/map/mutable/UnifiedMapTestCase.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/map/mutable/UnifiedMapTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -242,7 +242,7 @@ public void entrySet_toArray_withLargeTarget() { MutableMap map = this.newMapWithKeyValue(1, "One"); Map.Entry[] target = new Map.Entry[4]; - ImmutableEntry immutableEntry = new ImmutableEntry<>(null, null); + Map.Entry immutableEntry = new ImmutableEntry<>(null, null); target[1] = immutableEntry; target[2] = immutableEntry; target[3] = immutableEntry; diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/map/sorted/immutable/ImmutableEmptySortedMapTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/map/sorted/immutable/ImmutableEmptySortedMapTest.java index fe72df9884..7144238740 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/map/sorted/immutable/ImmutableEmptySortedMapTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/map/sorted/immutable/ImmutableEmptySortedMapTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -12,6 +12,7 @@ import java.util.Comparator; import java.util.NoSuchElementException; +import java.util.SortedMap; import org.eclipse.collections.api.block.function.Function2; import org.eclipse.collections.api.map.ImmutableMap; @@ -393,9 +394,9 @@ public void containsKey() @Test public void values() { - ImmutableEmptySortedMap map = (ImmutableEmptySortedMap) + SortedMap map = (ImmutableEmptySortedMap) this.classUnderTest(); - ImmutableEmptySortedMap revMap = (ImmutableEmptySortedMap) + SortedMap revMap = (ImmutableEmptySortedMap) this.classUnderTest(Comparators.reverseNaturalOrder()); Verify.assertEmpty(map.values()); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/map/sorted/immutable/ImmutableTreeMapTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/map/sorted/immutable/ImmutableTreeMapTest.java index 5cb3099172..e6a6836957 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/map/sorted/immutable/ImmutableTreeMapTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/map/sorted/immutable/ImmutableTreeMapTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -15,6 +15,7 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; +import java.util.SortedMap; import org.eclipse.collections.api.LazyIterable; import org.eclipse.collections.api.list.MutableList; @@ -140,14 +141,14 @@ public void lastKey_throws() @Test public void keySet() { - ImmutableTreeMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); + SortedMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); Verify.assertSetsEqual(Sets.mutable.of(1, 2, 3, 4), immutableSortedMap.keySet()); } @Test public void keySetContains() { - ImmutableTreeMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); + SortedMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); Set keySet = immutableSortedMap.keySet(); Assert.assertTrue(keySet.contains(1)); Assert.assertTrue(keySet.contains(2)); @@ -159,7 +160,7 @@ public void keySetContains() @Test public void keySetContainsAll() { - ImmutableTreeMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); + SortedMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); Set keySet = immutableSortedMap.keySet(); Assert.assertTrue(keySet.containsAll(UnifiedSet.newSetWith(1, 2, 3, 4))); Assert.assertTrue(keySet.containsAll(UnifiedSet.newSetWith(1, 4))); @@ -191,14 +192,14 @@ public void keySetToString() @Test public void keySetEqualsAndHashCode() { - ImmutableTreeMap map = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3")); + SortedMap map = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3")); Verify.assertEqualsAndHashCode(UnifiedSet.newSetWith(1, 2, 3), map.keySet()); } @Test public void keySetToArray() { - ImmutableTreeMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); + SortedMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); MutableList expected = FastList.newListWith(1, 2, 3, 4).toSortedList(); Set keySet = immutableSortedMap.keySet(); Object[] array = keySet.toArray(); @@ -214,7 +215,7 @@ public void keySetToArray() @Test public void keySet_toArray_withSmallTarget() { - ImmutableTreeMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); + SortedMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); Integer[] destination = new Integer[2]; // deliberately to small to force the method to allocate one of the correct size Integer[] result = immutableSortedMap.keySet().toArray(destination); Arrays.sort(result); @@ -224,7 +225,7 @@ public void keySet_toArray_withSmallTarget() @Test public void keySet_ToArray_withLargeTarget() { - ImmutableTreeMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); + SortedMap immutableSortedMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); Integer[] target = new Integer[6]; // deliberately large to force the extra to be set to null target[4] = 42; target[5] = 42; @@ -290,7 +291,7 @@ public void tailMap() @Test public void ofSortedMap() { - ImmutableTreeMap immutableMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); + SortedMap immutableMap = new ImmutableTreeMap<>(SortedMaps.mutable.of(1, "1", 2, "2", 3, "3", 4, "4")); Assert.assertSame(immutableMap, SortedMaps.immutable.ofSortedMap(immutableMap)); } } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/map/strategy/mutable/UnifiedMapWithHashingStrategyTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/map/strategy/mutable/UnifiedMapWithHashingStrategyTest.java index 55f86dde1f..7f5b898879 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/map/strategy/mutable/UnifiedMapWithHashingStrategyTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/map/strategy/mutable/UnifiedMapWithHashingStrategyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -809,7 +809,7 @@ public void equals_with_hashing_strategy() UnifiedMapWithHashingStrategy map3 = UnifiedMapWithHashingStrategy.newWithKeysValues( LAST_NAME_HASHING_STRATEGY, JOHNDOE, 1, JANEDOE, 2, JOHNSMITH, 3, JANESMITH, 4); UnifiedMapWithHashingStrategy map4 = UnifiedMapWithHashingStrategy.newMap(map3); - HashMap hashMap = new HashMap<>(map3); + Map hashMap = new HashMap<>(map3); Verify.assertEqualsAndHashCode(map3, map4); Assert.assertTrue(map3.equals(hashMap) && hashMap.equals(map3) && map3.hashCode() != hashMap.hashCode()); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/parallel/ParallelIterateTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/parallel/ParallelIterateTest.java index d41300bf6a..9d53aef153 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/parallel/ParallelIterateTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/parallel/ParallelIterateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -280,7 +280,7 @@ public void testForEachWithException() public void testForEachWithIndexToArrayUsingFastListSerialPath() { Integer[] array = new Integer[200]; - FastList list = (FastList) Interval.oneTo(200).toList(); + MutableList list = new FastList<>(Interval.oneTo(200)); Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull())); ParallelIterate.forEachWithIndex(list, (each, index) -> array[index] = each); Assert.assertArrayEquals(array, list.toArray(new Integer[]{})); @@ -290,7 +290,7 @@ public void testForEachWithIndexToArrayUsingFastListSerialPath() public void testForEachWithIndexToArrayUsingFastList() { Integer[] array = new Integer[200]; - FastList list = (FastList) Interval.oneTo(200).toList(); + MutableList list = new FastList<>(Interval.oneTo(200)); Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull())); ParallelIterate.forEachWithIndex(list, (each, index) -> array[index] = each, 10, 10); Assert.assertArrayEquals(array, list.toArray(new Integer[]{})); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/bag/PartitionHashBagTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/bag/PartitionHashBagTest.java index cada52e193..929b23d386 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/bag/PartitionHashBagTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/bag/PartitionHashBagTest.java @@ -13,6 +13,7 @@ import org.eclipse.collections.api.bag.MutableBag; import org.eclipse.collections.api.factory.Bags; import org.eclipse.collections.api.partition.bag.PartitionImmutableBag; +import org.eclipse.collections.api.partition.bag.PartitionMutableBag; import org.junit.Assert; import org.junit.Test; @@ -21,7 +22,7 @@ public class PartitionHashBagTest @Test public void toImmutable() { - PartitionHashBag partitionHashBag = new PartitionHashBag<>(); + PartitionMutableBag partitionHashBag = new PartitionHashBag<>(); MutableBag selected = Bags.mutable.of(1, 2, 3); MutableBag rejected = Bags.mutable.of(4, 5, 6); partitionHashBag.getSelected().withAll(selected); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/bag/sorted/PartitionTreeBagTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/bag/sorted/PartitionTreeBagTest.java index 8101181501..1f6e18d984 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/bag/sorted/PartitionTreeBagTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/bag/sorted/PartitionTreeBagTest.java @@ -13,6 +13,7 @@ import org.eclipse.collections.api.bag.sorted.MutableSortedBag; import org.eclipse.collections.api.factory.SortedBags; import org.eclipse.collections.api.partition.bag.sorted.PartitionImmutableSortedBag; +import org.eclipse.collections.api.partition.bag.sorted.PartitionMutableSortedBag; import org.eclipse.collections.impl.block.factory.Comparators; import org.junit.Assert; import org.junit.Test; @@ -22,7 +23,7 @@ public class PartitionTreeBagTest @Test public void toImmutable() { - PartitionTreeBag partitionTreeBag = new PartitionTreeBag<>(Comparators.naturalOrder()); + PartitionMutableSortedBag partitionTreeBag = new PartitionTreeBag<>(Comparators.naturalOrder()); MutableSortedBag selected = SortedBags.mutable.of(1, 2, 3); MutableSortedBag rejected = SortedBags.mutable.of(4, 5, 6); partitionTreeBag.getSelected().addAll(selected); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/list/PartitionFastListTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/list/PartitionFastListTest.java index 1f1f890637..dacaabd016 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/list/PartitionFastListTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/list/PartitionFastListTest.java @@ -13,6 +13,7 @@ import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.api.partition.list.PartitionImmutableList; +import org.eclipse.collections.api.partition.list.PartitionMutableList; import org.junit.Assert; import org.junit.Test; @@ -23,7 +24,7 @@ public void toImmutable() { MutableList selected = Lists.mutable.of(1, 2, 3); MutableList rejected = Lists.mutable.of(4, 5, 6); - PartitionFastList partitionedList = new PartitionFastList<>(); + PartitionMutableList partitionedList = new PartitionFastList<>(); partitionedList.getSelected().addAll(selected); partitionedList.getRejected().addAll(rejected); PartitionImmutableList immutable = partitionedList.toImmutable(); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/PartitionUnifiedSetTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/PartitionUnifiedSetTest.java index 06fa7b6e3f..cbd0fd6948 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/PartitionUnifiedSetTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/PartitionUnifiedSetTest.java @@ -12,6 +12,7 @@ import org.eclipse.collections.api.factory.Sets; import org.eclipse.collections.api.partition.set.PartitionImmutableSet; +import org.eclipse.collections.api.partition.set.PartitionMutableSet; import org.eclipse.collections.api.set.MutableSet; import org.junit.Assert; import org.junit.Test; @@ -21,7 +22,7 @@ public class PartitionUnifiedSetTest @Test public void toImmutable() { - PartitionUnifiedSet partitionUnifiedSet = new PartitionUnifiedSet<>(); + PartitionMutableSet partitionUnifiedSet = new PartitionUnifiedSet<>(); MutableSet selected = Sets.mutable.of(1, 2, 3); MutableSet rejected = Sets.mutable.of(4, 5, 6); partitionUnifiedSet.getSelected().addAll(selected); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/sorted/PartitionTreeSortedSetTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/sorted/PartitionTreeSortedSetTest.java index 5135118f78..928ce445f3 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/sorted/PartitionTreeSortedSetTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/sorted/PartitionTreeSortedSetTest.java @@ -12,6 +12,7 @@ import org.eclipse.collections.api.factory.SortedSets; import org.eclipse.collections.api.partition.set.sorted.PartitionImmutableSortedSet; +import org.eclipse.collections.api.partition.set.sorted.PartitionMutableSortedSet; import org.eclipse.collections.api.set.sorted.MutableSortedSet; import org.eclipse.collections.impl.block.factory.Comparators; import org.junit.Assert; @@ -22,7 +23,7 @@ public class PartitionTreeSortedSetTest @Test public void toImmutable() { - PartitionTreeSortedSet partitionTreeSortedSet = new PartitionTreeSortedSet<>(Comparators.naturalOrder()); + PartitionMutableSortedSet partitionTreeSortedSet = new PartitionTreeSortedSet<>(Comparators.naturalOrder()); MutableSortedSet selected = SortedSets.mutable.of(1, 2, 3); MutableSortedSet rejected = SortedSets.mutable.of(4, 5, 6); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/strategy/PartitionUnifiedSetWithHashingStrategyTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/strategy/PartitionUnifiedSetWithHashingStrategyTest.java index 3eeb980368..d0dbc543f2 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/strategy/PartitionUnifiedSetWithHashingStrategyTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/partition/set/strategy/PartitionUnifiedSetWithHashingStrategyTest.java @@ -12,6 +12,7 @@ import org.eclipse.collections.api.factory.Sets; import org.eclipse.collections.api.partition.set.PartitionImmutableSet; +import org.eclipse.collections.api.partition.set.PartitionMutableSet; import org.eclipse.collections.api.set.MutableSet; import org.eclipse.collections.impl.block.factory.HashingStrategies; import org.junit.Assert; @@ -22,7 +23,7 @@ public class PartitionUnifiedSetWithHashingStrategyTest @Test public void toImmutable() { - PartitionUnifiedSetWithHashingStrategy partitionUnifiedSetWithHashingStrategy = + PartitionMutableSet partitionUnifiedSetWithHashingStrategy = new PartitionUnifiedSetWithHashingStrategy<>(HashingStrategies.defaultStrategy()); MutableSet selected = Sets.mutable.of(1, 2, 3); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/UnifiedSetWithHashingStrategyTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/UnifiedSetWithHashingStrategyTest.java index da8f0dcfec..c8745a6502 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/UnifiedSetWithHashingStrategyTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/UnifiedSetWithHashingStrategyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -12,6 +12,7 @@ import java.util.HashSet; import java.util.Iterator; +import java.util.Set; import org.eclipse.collections.api.LazyIterable; import org.eclipse.collections.api.block.HashingStrategy; @@ -826,7 +827,7 @@ public void equals_with_hashingStrategy() Verify.assertEqualsAndHashCode(setA, setB); //Checking that a hashing set is symmetrically equal to an identical JDK set - HashSet hashSet = new HashSet<>(setA); + Set hashSet = new HashSet<>(setA); Assert.assertTrue(hashSet.equals(setA) && setA.equals(hashSet)); //Checking that a hash set is symmetrically equal to an identical Eclipse Collections set diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/AbstractBooleanSetTestCase.java b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/AbstractBooleanSetTestCase.java index 38b597981b..06fdf88cba 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/AbstractBooleanSetTestCase.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/AbstractBooleanSetTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -566,7 +566,7 @@ public void booleanIterator() Assert.assertThrows(NoSuchElementException.class, booleanIterator2::next); BooleanIterator booleanIterator3 = this.setWithTrueFalse.booleanIterator(); - BooleanHashSet actual = new BooleanHashSet(); + MutableBooleanSet actual = new BooleanHashSet(); Assert.assertTrue(booleanIterator3.hasNext()); actual.add(booleanIterator3.next()); Assert.assertTrue(booleanIterator3.hasNext()); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/AbstractByteSetTestCase.java b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/AbstractByteSetTestCase.java index 9329d8e937..5c9edb14d2 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/AbstractByteSetTestCase.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/AbstractByteSetTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -128,7 +128,7 @@ public void addAllIterable() Assert.assertTrue(set.addAll(ByteHashSet.newSetWith((byte) 5))); Assert.assertEquals(ByteHashSet.newSetWith((byte) 0, (byte) 1, (byte) 2, (byte) 5, (byte) 30, (byte) 31, (byte) 31, (byte) -1, (byte) -128), set); - ByteHashSet set1 = new ByteHashSet(); + MutableByteSet set1 = new ByteHashSet(); Assert.assertTrue(set1.addAll((byte) 2, (byte) 35)); Assert.assertEquals(ByteHashSet.newSetWith((byte) 2, (byte) 35), set1); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/BooleanHashSetTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/BooleanHashSetTest.java index 8af7a5df4f..7d1935fcee 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/BooleanHashSetTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/BooleanHashSetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -14,6 +14,7 @@ import java.util.NoSuchElementException; import org.eclipse.collections.api.iterator.MutableBooleanIterator; +import org.eclipse.collections.api.set.primitive.MutableBooleanSet; import org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList; import org.eclipse.collections.impl.test.Verify; import org.junit.Assert; @@ -85,7 +86,7 @@ public void booleanIterator_with_remove() Verify.assertEmpty(trueSet); Assert.assertThrows(NoSuchElementException.class, mutableBooleanIterator::next); Assert.assertThrows(IllegalStateException.class, mutableBooleanIterator::remove); - BooleanHashSet emptySet = new BooleanHashSet(); + MutableBooleanSet emptySet = new BooleanHashSet(); mutableBooleanIterator = emptySet.booleanIterator(); Assert.assertFalse(mutableBooleanIterator.hasNext()); Verify.assertEmpty(emptySet); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/ByteHashSetTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/ByteHashSetTest.java index 5b93f80adb..067c2824e3 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/ByteHashSetTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/ByteHashSetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -239,7 +239,7 @@ public void testEqualsContainingElements() @Test public void addAndCheckField() { - ByteHashSet hashSet = new ByteHashSet(); + MutableByteSet hashSet = new ByteHashSet(); Assert.assertTrue(hashSet.add((byte) 14)); Assert.assertFalse(hashSet.add((byte) 14)); Assert.assertTrue(hashSet.add((byte) 2)); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/ImmutableBooleanHashSetTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/ImmutableBooleanHashSetTest.java index e69c2d4240..766073da0c 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/ImmutableBooleanHashSetTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/ImmutableBooleanHashSetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -262,7 +262,7 @@ public void booleanIterator() BooleanIterator booleanIterator3 = this.trueFalseSet.booleanIterator(); Assert.assertTrue(booleanIterator3.hasNext()); - BooleanHashSet actual = new BooleanHashSet(); + MutableBooleanSet actual = new BooleanHashSet(); actual.add(booleanIterator3.next()); Assert.assertTrue(booleanIterator3.hasNext()); actual.add(booleanIterator3.next()); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/LongHashSetExtraTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/LongHashSetExtraTest.java index 1a0a37c4af..5b6bcb6f3f 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/LongHashSetExtraTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/set/mutable/primitive/LongHashSetExtraTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -14,6 +14,7 @@ import java.util.Random; import org.eclipse.collections.api.block.predicate.primitive.LongPredicate; +import org.eclipse.collections.api.set.primitive.MutableLongSet; import org.junit.Assert; import org.junit.Test; @@ -54,7 +55,7 @@ public void testManyRemoves() @Test public void testArrayGrowth() throws Exception { - LongHashSet set = new LongHashSet(); + MutableLongSet set = new LongHashSet(); long putLong = 0; for (; putLong < 1000L; putLong++) { diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/stack/mutable/ArrayStackTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/stack/mutable/ArrayStackTest.java index 141b7c4421..0acb0de7cd 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/stack/mutable/ArrayStackTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/stack/mutable/ArrayStackTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -96,14 +96,14 @@ public void hasSameElements() @Test public void forEach_exception() { - ArrayStack arrayStack = new ArrayStack<>(); + MutableStack arrayStack = new ArrayStack<>(); Assert.assertThrows(UnsupportedOperationException.class, () -> arrayStack.forEach(0, 1, null)); } @Test public void forEachWithIndex_exception() { - ArrayStack arrayStack = new ArrayStack<>(); + MutableStack arrayStack = new ArrayStack<>(); Assert.assertThrows(UnsupportedOperationException.class, () -> arrayStack.forEachWithIndex(0, 1, null)); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/stack/primitive/AbstractBooleanStackTestCase.java b/unit-tests/src/test/java/org/eclipse/collections/impl/stack/primitive/AbstractBooleanStackTestCase.java index f2301aadc1..cbae0a8bcb 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/stack/primitive/AbstractBooleanStackTestCase.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/stack/primitive/AbstractBooleanStackTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -12,6 +12,7 @@ import org.eclipse.collections.api.RichIterable; import org.eclipse.collections.api.iterator.BooleanIterator; +import org.eclipse.collections.api.list.primitive.MutableBooleanList; import org.eclipse.collections.api.stack.primitive.BooleanStack; import org.eclipse.collections.api.stack.primitive.ImmutableBooleanStack; import org.eclipse.collections.impl.collection.mutable.primitive.AbstractBooleanIterableTestCase; @@ -113,7 +114,7 @@ public void testToString() public void toList() { super.toList(); - BooleanArrayList list = new BooleanArrayList(); + MutableBooleanList list = new BooleanArrayList(); int size = this.classUnderTest().size(); for (int i = 0; i < size; i++) { diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/tuple/AbstractImmutableEntryTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/tuple/AbstractImmutableEntryTest.java index e9690b7e50..b4561a43e2 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/tuple/AbstractImmutableEntryTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/tuple/AbstractImmutableEntryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -10,6 +10,8 @@ package org.eclipse.collections.impl.tuple; +import java.util.Map; + import org.junit.Assert; import org.junit.Test; @@ -18,14 +20,14 @@ public class AbstractImmutableEntryTest @Test public void getKeyFunction() { - ImmutableEntry entry = new ImmutableEntry<>("foo", 2); + Map.Entry entry = new ImmutableEntry<>("foo", 2); Assert.assertEquals("foo", AbstractImmutableEntry.getKeyFunction().valueOf(entry)); } @Test public void getValueFunction() { - ImmutableEntry entry = new ImmutableEntry<>("foo", 2); + Map.Entry entry = new ImmutableEntry<>("foo", 2); Assert.assertEquals(Integer.valueOf(2), AbstractImmutableEntry.getValueFunction().valueOf(entry)); } } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/utility/ArrayListIterateTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/utility/ArrayListIterateTest.java index f6db1eca8f..368e5d4e12 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/utility/ArrayListIterateTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/utility/ArrayListIterateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -377,7 +377,7 @@ public void collectBooleanOverOptimizeLimit() { ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableBooleanList actual = ArrayListIterate.collectBoolean(list, PrimitiveFunctions.integerIsPositive()); - BooleanArrayList expected = new BooleanArrayList(list.size()); + MutableBooleanList expected = new BooleanArrayList(list.size()); expected.add(false); for (int i = 1; i <= OVER_OPTIMIZED_LIMIT; i++) { @@ -392,7 +392,7 @@ public void collectBooleanWithTargetOverOptimizeLimit() ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableBooleanList target = new BooleanArrayList(); MutableBooleanList actual = ArrayListIterate.collectBoolean(list, PrimitiveFunctions.integerIsPositive(), target); - BooleanArrayList expected = new BooleanArrayList(list.size()); + MutableBooleanList expected = new BooleanArrayList(list.size()); expected.add(false); for (int i = 1; i <= OVER_OPTIMIZED_LIMIT; i++) { @@ -425,7 +425,7 @@ public void collectByteOverOptimizeLimit() { ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableByteList actual = ArrayListIterate.collectByte(list, PrimitiveFunctions.unboxIntegerToByte()); - ByteArrayList expected = new ByteArrayList(list.size()); + MutableByteList expected = new ByteArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((byte) i); @@ -439,7 +439,7 @@ public void collectByteWithTargetOverOptimizeLimit() ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableByteList target = new ByteArrayList(); MutableByteList actual = ArrayListIterate.collectByte(list, PrimitiveFunctions.unboxIntegerToByte(), target); - ByteArrayList expected = new ByteArrayList(list.size()); + MutableByteList expected = new ByteArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((byte) i); @@ -471,7 +471,7 @@ public void collectCharOverOptimizeLimit() { ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableCharList actual = ArrayListIterate.collectChar(list, PrimitiveFunctions.unboxIntegerToChar()); - CharArrayList expected = new CharArrayList(list.size()); + MutableCharList expected = new CharArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((char) i); @@ -485,7 +485,7 @@ public void collectCharWithTargetOverOptimizeLimit() ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableCharList target = new CharArrayList(); MutableCharList actual = ArrayListIterate.collectChar(list, PrimitiveFunctions.unboxIntegerToChar(), target); - CharArrayList expected = new CharArrayList(list.size()); + MutableCharList expected = new CharArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((char) i); @@ -517,7 +517,7 @@ public void collectDoubleOverOptimizeLimit() { ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableDoubleList actual = ArrayListIterate.collectDouble(list, PrimitiveFunctions.unboxIntegerToDouble()); - DoubleArrayList expected = new DoubleArrayList(list.size()); + MutableDoubleList expected = new DoubleArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((double) i); @@ -531,7 +531,7 @@ public void collectDoubleWithTargetOverOptimizeLimit() ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableDoubleList target = new DoubleArrayList(); MutableDoubleList actual = ArrayListIterate.collectDouble(list, PrimitiveFunctions.unboxIntegerToDouble(), target); - DoubleArrayList expected = new DoubleArrayList(list.size()); + MutableDoubleList expected = new DoubleArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((double) i); @@ -563,7 +563,7 @@ public void collectFloatOverOptimizeLimit() { ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableFloatList actual = ArrayListIterate.collectFloat(list, PrimitiveFunctions.unboxIntegerToFloat()); - FloatArrayList expected = new FloatArrayList(list.size()); + MutableFloatList expected = new FloatArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((float) i); @@ -577,7 +577,7 @@ public void collectFloatWithTargetOverOptimizeLimit() ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableFloatList target = new FloatArrayList(); MutableFloatList actual = ArrayListIterate.collectFloat(list, PrimitiveFunctions.unboxIntegerToFloat(), target); - FloatArrayList expected = new FloatArrayList(list.size()); + MutableFloatList expected = new FloatArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((float) i); @@ -609,7 +609,7 @@ public void collectIntOverOptimizeLimit() { ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableIntList actual = ArrayListIterate.collectInt(list, PrimitiveFunctions.unboxIntegerToInt()); - IntArrayList expected = new IntArrayList(list.size()); + MutableIntList expected = new IntArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add(i); @@ -623,7 +623,7 @@ public void collectIntWithTargetOverOptimizeLimit() ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableIntList target = new IntArrayList(); MutableIntList actual = ArrayListIterate.collectInt(list, PrimitiveFunctions.unboxIntegerToInt(), target); - IntArrayList expected = new IntArrayList(list.size()); + MutableIntList expected = new IntArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add(i); @@ -655,7 +655,7 @@ public void collectLongOverOptimizeLimit() { ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableLongList actual = ArrayListIterate.collectLong(list, PrimitiveFunctions.unboxIntegerToLong()); - LongArrayList expected = new LongArrayList(list.size()); + MutableLongList expected = new LongArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((long) i); @@ -669,7 +669,7 @@ public void collectLongWithTargetOverOptimizeLimit() ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableLongList target = new LongArrayList(); MutableLongList actual = ArrayListIterate.collectLong(list, PrimitiveFunctions.unboxIntegerToLong(), target); - LongArrayList expected = new LongArrayList(list.size()); + MutableLongList expected = new LongArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((long) i); @@ -701,7 +701,7 @@ public void collectShortOverOptimizeLimit() { ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableShortList actual = ArrayListIterate.collectShort(list, PrimitiveFunctions.unboxIntegerToShort()); - ShortArrayList expected = new ShortArrayList(list.size()); + MutableShortList expected = new ShortArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((short) i); @@ -715,7 +715,7 @@ public void collectShortWithTargetOverOptimizeLimit() ArrayList list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT)); MutableShortList target = new ShortArrayList(); MutableShortList actual = ArrayListIterate.collectShort(list, PrimitiveFunctions.unboxIntegerToShort(), target); - ShortArrayList expected = new ShortArrayList(list.size()); + MutableShortList expected = new ShortArrayList(list.size()); for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) { expected.add((short) i); @@ -1246,7 +1246,7 @@ public void detectLastIndexSmallList() @Test public void detectIndexWithOver100() { - ArrayList list = new ArrayList<>(Interval.toReverseList(1, 101)); + List list = new ArrayList<>(Interval.toReverseList(1, 101)); Assert.assertEquals(100, Iterate.detectIndexWith(list, Object::equals, 1)); Assert.assertEquals(0, Iterate.detectIndexWith(list, Object::equals, 101)); Assert.assertEquals(-1, Iterate.detectIndexWith(list, Object::equals, 200)); @@ -1255,7 +1255,7 @@ public void detectIndexWithOver100() @Test public void detectIndexWithSmallList() { - ArrayList list = new ArrayList<>(Interval.toReverseList(1, 5)); + List list = new ArrayList<>(Interval.toReverseList(1, 5)); Assert.assertEquals(4, Iterate.detectIndexWith(list, Object::equals, 1)); Assert.assertEquals(0, Iterate.detectIndexWith(list, Object::equals, 5)); Assert.assertEquals(-1, Iterate.detectIndexWith(list, Object::equals, 10)); diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/utility/ListIterateTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/utility/ListIterateTest.java index 3d4b061195..3b55d1cb98 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/utility/ListIterateTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/utility/ListIterateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs and others. + * Copyright (c) 2022 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. @@ -68,7 +68,7 @@ public void injectInto() @Test public void toArray() { - LinkedList notAnArrayList = new LinkedList<>(Interval.oneTo(10)); + List notAnArrayList = new LinkedList<>(Interval.oneTo(10)); Integer[] target1 = {1, 2, null, null}; ListIterate.toArray(notAnArrayList, target1, 2, 2); Assert.assertArrayEquals(target1, new Integer[]{1, 2, 1, 2}); @@ -82,7 +82,7 @@ public void toArray() @Test(expected = ArrayIndexOutOfBoundsException.class) public void toArray_throws() { - LinkedList notAnArrayList = new LinkedList<>(Interval.oneTo(10)); + List notAnArrayList = new LinkedList<>(Interval.oneTo(10)); Integer[] target1 = {1, 2, null, null}; ListIterate.toArray(notAnArrayList, target1, 2, 10); } @@ -506,7 +506,7 @@ public void minBy() Assert.assertEquals(twinTwo, ListIterate.minBy(list, Functions.firstOfPair())); Assert.assertEquals(twinOne, ListIterate.minBy(list, Functions.secondOfPair())); - LinkedList> linkedList = new LinkedList<>(Lists.mutable.of(twinOne, twinTwo)); + List> linkedList = new LinkedList<>(Lists.mutable.of(twinOne, twinTwo)); Assert.assertEquals(twinTwo, ListIterate.minBy(linkedList, Functions.firstOfPair())); Assert.assertEquals(twinOne, ListIterate.minBy(linkedList, Functions.secondOfPair())); } @@ -536,7 +536,7 @@ public void maxBy() Assert.assertEquals(twinOne, ListIterate.maxBy(list, Functions.firstOfPair())); Assert.assertEquals(twinTwo, ListIterate.maxBy(list, Functions.secondOfPair())); - LinkedList> linkedList = new LinkedList<>(Lists.mutable.of(twinOne, twinTwo)); + List> linkedList = new LinkedList<>(Lists.mutable.of(twinOne, twinTwo)); Assert.assertEquals(twinOne, ListIterate.maxBy(linkedList, Functions.firstOfPair())); Assert.assertEquals(twinTwo, ListIterate.maxBy(linkedList, Functions.secondOfPair())); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/utility/MapIterateTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/utility/MapIterateTest.java index 6cc70b418f..67752a8e89 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/utility/MapIterateTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/utility/MapIterateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -21,6 +21,7 @@ import org.eclipse.collections.api.block.function.Function; import org.eclipse.collections.api.block.function.Function2; import org.eclipse.collections.api.block.predicate.Predicate2; +import org.eclipse.collections.api.block.procedure.Procedure2; import org.eclipse.collections.api.collection.primitive.MutableBooleanCollection; import org.eclipse.collections.api.collection.primitive.MutableByteCollection; import org.eclipse.collections.api.collection.primitive.MutableCharCollection; @@ -280,7 +281,7 @@ public void forEachKeyValue() MutableMap map = UnifiedMap.newMap(); map.putAll(UnifiedMap.newMap(this.getIntegerMap())); MutableMap newMap = UnifiedMap.newMap(); - MapPutProcedure procedure = new MapPutProcedure<>(newMap); + Procedure2 procedure = new MapPutProcedure<>(newMap); MapIterate.forEachKeyValue(map, procedure); Verify.assertMapsEqual(map, newMap); } diff --git a/unit-tests/src/test/java/org/eclipse/collections/impl/utility/internal/IterableIterateTest.java b/unit-tests/src/test/java/org/eclipse/collections/impl/utility/internal/IterableIterateTest.java index 161a67724b..ee066eb4c6 100644 --- a/unit-tests/src/test/java/org/eclipse/collections/impl/utility/internal/IterableIterateTest.java +++ b/unit-tests/src/test/java/org/eclipse/collections/impl/utility/internal/IterableIterateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Goldman Sachs. + * Copyright (c) 2022 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. @@ -594,7 +594,7 @@ public void removeIfWith() public void forEach() { MutableList newCollection = Lists.mutable.of(); - IterableAdapter iterable = new IterableAdapter<>(Interval.oneTo(10)); + Iterable iterable = new IterableAdapter<>(Interval.oneTo(10)); Iterate.forEach(iterable, newCollection::add); Assert.assertEquals(Interval.oneTo(10), newCollection); }