Skip to content

Commit

Permalink
Merge pull request #934 from motlin/remove-toStack
Browse files Browse the repository at this point in the history
Remove implementations of OrderedIterable.toStack() that can use the default implementation instead.
  • Loading branch information
donraab committed Aug 13, 2020
2 parents 19c4676 + 5a8c177 commit 6eb479f
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -842,12 +842,6 @@ protected MutableCollection<T> newMutable(int size)
return FastList.newList(size);
}

@Override
public MutableStack<T> toStack()
{
return ArrayStack.newStack(this);
}

@Override
public ReverseIterable<T> asReversed()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.eclipse.collections.api.block.procedure.Procedure2;
import org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure;
import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.factory.Stacks;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.api.list.ParallelListIterable;
import org.eclipse.collections.api.list.primitive.MutableBooleanList;
Expand Down Expand Up @@ -504,12 +503,6 @@ public MutableSet<T> toSet()
return UnifiedSet.newSet(this);
}

@Override
public MutableStack<T> toStack()
{
return Stacks.mutable.withAll(this);
}

@Override
public MutableList<T> asUnmodifiable()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
import org.eclipse.collections.api.list.ParallelListIterable;
import org.eclipse.collections.api.ordered.OrderedIterable;
import org.eclipse.collections.api.partition.list.PartitionMutableList;
import org.eclipse.collections.api.stack.MutableStack;
import org.eclipse.collections.impl.block.procedure.CollectionAddProcedure;
import org.eclipse.collections.impl.lazy.parallel.list.NonParallelListIterable;
import org.eclipse.collections.impl.stack.mutable.ArrayStack;
import org.eclipse.collections.impl.utility.ArrayIterate;
import org.eclipse.collections.impl.utility.ListIterate;
import org.eclipse.collections.impl.utility.OrderedIterate;
Expand Down Expand Up @@ -342,12 +340,6 @@ public PartitionMutableList<T> partitionWhile(Predicate<? super T> predicate)
return ListIterate.partitionWhile(this.delegate, predicate);
}

@Override
public MutableStack<T> toStack()
{
return ArrayStack.newStack(this.delegate);
}

@Override
public ParallelListIterable<T> asParallel(ExecutorService executorService, int batchSize)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@
import org.eclipse.collections.api.multimap.list.MutableListMultimap;
import org.eclipse.collections.api.ordered.OrderedIterable;
import org.eclipse.collections.api.partition.list.PartitionMutableList;
import org.eclipse.collections.api.stack.MutableStack;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.impl.collection.mutable.AbstractUnmodifiableMutableCollection;
import org.eclipse.collections.impl.collection.mutable.UnmodifiableCollectionSerializationProxy;
import org.eclipse.collections.impl.lazy.ReverseIterable;
import org.eclipse.collections.impl.stack.mutable.ArrayStack;

/**
* An unmodifiable view of a list.
Expand Down Expand Up @@ -209,12 +207,6 @@ public MutableList<T> shuffleThis(Random rnd)
throw new UnsupportedOperationException("Cannot call shuffleThis() on " + this.getClass().getSimpleName());
}

@Override
public MutableStack<T> toStack()
{
return ArrayStack.newStack(this.getMutableList());
}

@Override
public <V extends Comparable<? super V>> MutableList<T> sortThisBy(Function<? super T, ? extends V> function)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
import org.eclipse.collections.api.partition.list.PartitionMutableList;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.collections.api.set.sorted.MutableSortedSet;
import org.eclipse.collections.api.stack.MutableStack;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.impl.UnmodifiableIteratorAdapter;
import org.eclipse.collections.impl.tuple.AbstractImmutableEntry;
Expand Down Expand Up @@ -1566,12 +1565,6 @@ public void forEachWithIndex(
this.delegate.forEachWithIndex(fromIndex, toIndex, objectIntProcedure);
}

@Override
public MutableStack<V> toStack()
{
return this.delegate.toStack();
}

@Override
public <VV, R extends Collection<VV>> R collectWithIndex(
ObjectIntToObjectFunction<? super V, ? extends VV> function,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import org.eclipse.collections.api.set.sorted.MutableSortedSet;
import org.eclipse.collections.api.set.sorted.ParallelSortedSetIterable;
import org.eclipse.collections.api.set.sorted.SortedSetIterable;
import org.eclipse.collections.api.stack.MutableStack;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.impl.block.factory.Comparators;
import org.eclipse.collections.impl.block.factory.Functions;
Expand Down Expand Up @@ -81,7 +80,6 @@
import org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList;
import org.eclipse.collections.impl.multimap.set.sorted.TreeSortedSetMultimap;
import org.eclipse.collections.impl.partition.set.sorted.PartitionTreeSortedSet;
import org.eclipse.collections.impl.stack.mutable.ArrayStack;
import org.eclipse.collections.impl.utility.ArrayIterate;
import org.eclipse.collections.impl.utility.Iterate;
import org.eclipse.collections.impl.utility.ListIterate;
Expand Down Expand Up @@ -137,12 +135,6 @@ public ImmutableSortedSet<T> toImmutable()
return SortedSets.immutable.withSortedSet(this.delegate);
}

@Override
public MutableStack<T> toStack()
{
return ArrayStack.newStack(this);
}

public static <T> MutableSortedSet<T> adapt(SortedSet<T> set)
{
if (set instanceof MutableSortedSet<?>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import org.eclipse.collections.api.set.sorted.MutableSortedSet;
import org.eclipse.collections.api.set.sorted.ParallelSortedSetIterable;
import org.eclipse.collections.api.set.sorted.SortedSetIterable;
import org.eclipse.collections.api.stack.MutableStack;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.impl.block.factory.Comparators;
import org.eclipse.collections.impl.block.factory.Functions;
Expand Down Expand Up @@ -92,7 +91,6 @@
import org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList;
import org.eclipse.collections.impl.multimap.set.sorted.TreeSortedSetMultimap;
import org.eclipse.collections.impl.partition.set.sorted.PartitionTreeSortedSet;
import org.eclipse.collections.impl.stack.mutable.ArrayStack;
import org.eclipse.collections.impl.utility.ArrayIterate;
import org.eclipse.collections.impl.utility.Iterate;
import org.eclipse.collections.impl.utility.ListIterate;
Expand Down Expand Up @@ -204,12 +202,6 @@ public ImmutableSortedSet<T> toImmutable()
return SortedSets.immutable.withSortedSet(this);
}

@Override
public MutableStack<T> toStack()
{
return ArrayStack.newStack(this);
}

@Override
public boolean add(T element)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.eclipse.collections.api.set.sorted.MutableSortedSet;
import org.eclipse.collections.api.set.sorted.ParallelSortedSetIterable;
import org.eclipse.collections.api.set.sorted.SortedSetIterable;
import org.eclipse.collections.api.stack.MutableStack;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.impl.collection.mutable.AbstractUnmodifiableMutableCollection;
import org.eclipse.collections.impl.collection.mutable.UnmodifiableCollectionSerializationProxy;
Expand Down Expand Up @@ -452,12 +451,6 @@ public int compareTo(SortedSetIterable<T> o)
return this.getSortedSet().compareTo(o);
}

@Override
public MutableStack<T> toStack()
{
return this.getSortedSet().toStack();
}

@Override
public int indexOf(Object object)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.collections.api.set.sorted.MutableSortedSet;
import org.eclipse.collections.api.stack.ImmutableStack;
import org.eclipse.collections.api.stack.MutableStack;
import org.eclipse.collections.api.stack.StackIterable;
import org.eclipse.collections.api.stack.primitive.ImmutableBooleanStack;
import org.eclipse.collections.api.stack.primitive.ImmutableByteStack;
Expand All @@ -100,7 +99,6 @@
import org.eclipse.collections.impl.map.mutable.UnifiedMap;
import org.eclipse.collections.impl.multimap.list.FastListMultimap;
import org.eclipse.collections.impl.partition.stack.PartitionArrayStack;
import org.eclipse.collections.impl.stack.mutable.ArrayStack;
import org.eclipse.collections.impl.stack.mutable.primitive.BooleanArrayStack;
import org.eclipse.collections.impl.stack.mutable.primitive.ByteArrayStack;
import org.eclipse.collections.impl.stack.mutable.primitive.CharArrayStack;
Expand Down Expand Up @@ -299,12 +297,6 @@ public boolean containsAllArguments(Object... elements)
return this.delegate.asReversed().containsAllArguments(elements);
}

@Override
public MutableStack<T> toStack()
{
return ArrayStack.newStackFromTopToBottom(this);
}

@Override
public ImmutableStack<T> select(Predicate<? super T> predicate)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.eclipse.collections.api.ordered.OrderedIterable;
import org.eclipse.collections.api.partition.stack.PartitionImmutableStack;
import org.eclipse.collections.api.stack.ImmutableStack;
import org.eclipse.collections.api.stack.MutableStack;
import org.eclipse.collections.api.stack.StackIterable;
import org.eclipse.collections.api.stack.primitive.ImmutableBooleanStack;
import org.eclipse.collections.api.stack.primitive.ImmutableByteStack;
Expand Down Expand Up @@ -74,7 +73,6 @@
import org.eclipse.collections.impl.partition.stack.PartitionArrayStack;
import org.eclipse.collections.impl.partition.stack.PartitionArrayStack.PartitionPredicate2Procedure;
import org.eclipse.collections.impl.partition.stack.PartitionArrayStack.PartitionProcedure;
import org.eclipse.collections.impl.stack.mutable.ArrayStack;

final class ImmutableNotEmptyStack<T>
extends AbstractRichIterable<T>
Expand Down Expand Up @@ -189,12 +187,6 @@ public T getLast()
throw new UnsupportedOperationException("Cannot call getLast() on " + this.getClass().getSimpleName());
}

@Override
public MutableStack<T> toStack()
{
return ArrayStack.newStackFromTopToBottom(this);
}

@Override
public ImmutableStack<T> select(Predicate<? super T> predicate)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -998,12 +998,6 @@ public MutableSortedSet<T> toSortedSet(Comparator<? super T> comparator)
return this.delegate.asReversed().toSortedSet(comparator);
}

@Override
public MutableStack<T> toStack()
{
return ArrayStack.newStackFromTopToBottom(this);
}

@Override
public ImmutableStack<T> toImmutable()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,12 +650,6 @@ public MutableSortedSet<T> toSortedSet(Comparator<? super T> comparator)
return this.mutableStack.toSortedSet(comparator);
}

@Override
public MutableStack<T> toStack()
{
return this.mutableStack.toStack();
}

@Override
public ImmutableStack<T> toImmutable()
{
Expand Down

0 comments on commit 6eb479f

Please sign in to comment.