package org.eclipse.collections.api.ordered;
import org.eclipse.collections.api.LazyIterable;
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.function.Function2;
import org.eclipse.collections.api.block.function.primitive.BooleanFunction;
import org.eclipse.collections.api.block.function.primitive.ByteFunction;
import org.eclipse.collections.api.block.function.primitive.CharFunction;
import org.eclipse.collections.api.block.function.primitive.DoubleFunction;
import org.eclipse.collections.api.block.function.primitive.FloatFunction;
import org.eclipse.collections.api.block.function.primitive.IntFunction;
import org.eclipse.collections.api.block.function.primitive.LongFunction;
import org.eclipse.collections.api.block.function.primitive.ObjectIntToObjectFunction;
import org.eclipse.collections.api.block.function.primitive.ShortFunction;
import org.eclipse.collections.api.block.predicate.Predicate;
import org.eclipse.collections.api.block.predicate.Predicate2;
import org.eclipse.collections.api.block.procedure.Procedure;
import org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure;
import org.eclipse.collections.api.multimap.ordered.ReversibleIterableMultimap;
import org.eclipse.collections.api.ordered.primitive.ReversibleBooleanIterable;
import org.eclipse.collections.api.ordered.primitive.ReversibleByteIterable;
import org.eclipse.collections.api.ordered.primitive.ReversibleCharIterable;
import org.eclipse.collections.api.ordered.primitive.ReversibleDoubleIterable;
import org.eclipse.collections.api.ordered.primitive.ReversibleFloatIterable;
import org.eclipse.collections.api.ordered.primitive.ReversibleIntIterable;
import org.eclipse.collections.api.ordered.primitive.ReversibleLongIterable;
import org.eclipse.collections.api.ordered.primitive.ReversibleShortIterable;
import org.eclipse.collections.api.partition.ordered.PartitionReversibleIterable;
import org.eclipse.collections.api.tuple.Pair;
public interface ReversibleIterable<T> extends OrderedIterable<T>
{
default void reverseForEach(Procedure<? super T> procedure)
{
if (this.notEmpty())
{
this.forEach(this.size() - 1, 0, procedure);
}
}
default void reverseForEachWithIndex(ObjectIntProcedure<? super T> procedure)
{
if (this.notEmpty())
{
this.forEachWithIndex(this.size() - 1, 0, procedure);
}
}
default LazyIterable<T> asReversed()
{
throw new UnsupportedOperationException(this.getClass().getSimpleName() + ".asReversed() not implemented yet");
}
ReversibleIterable<T> toReversed();
int detectLastIndex(Predicate<? super T> predicate);
ReversibleIterable<T> take(int count);
@Override
ReversibleIterable<T> takeWhile(Predicate<? super T> predicate);
ReversibleIterable<T> drop(int count);
@Override
ReversibleIterable<T> dropWhile(Predicate<? super T> predicate);
@Override
PartitionReversibleIterable<T> partitionWhile(Predicate<? super T> predicate);
@Override
ReversibleIterable<T> distinct();
@Override
ReversibleIterable<T> tap(Procedure<? super T> procedure);
@Override
ReversibleIterable<T> select(Predicate<? super T> predicate);
@Override
<P> ReversibleIterable<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
@Override
ReversibleIterable<T> reject(Predicate<? super T> predicate);
@Override
<P> ReversibleIterable<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
@Override
PartitionReversibleIterable<T> partition(Predicate<? super T> predicate);
@Override
<P> PartitionReversibleIterable<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter);
@Override
<S> ReversibleIterable<S> selectInstancesOf(Class<S> clazz);
@Override
<V> ReversibleIterable<V> collect(Function<? super T, ? extends V> function);
@Override
default <V> ReversibleIterable<V> collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)
{
int[] index = {0};
return this.collect(each -> function.valueOf(each, index[0]++));
}
@Override
<P, V> ReversibleIterable<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter);
@Override
<V> ReversibleIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function);
@Override
<V> ReversibleIterable<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
@Override
default <P, V> ReversibleIterable<V> flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter)
{
return this.flatCollect(each -> function.apply(each, parameter));
}
@Override
ReversibleBooleanIterable collectBoolean(BooleanFunction<? super T> booleanFunction);
@Override
ReversibleByteIterable collectByte(ByteFunction<? super T> byteFunction);
@Override
ReversibleCharIterable collectChar(CharFunction<? super T> charFunction);
@Override
ReversibleDoubleIterable collectDouble(DoubleFunction<? super T> doubleFunction);
@Override
ReversibleFloatIterable collectFloat(FloatFunction<? super T> floatFunction);
@Override
ReversibleIntIterable collectInt(IntFunction<? super T> intFunction);
@Override
ReversibleLongIterable collectLong(LongFunction<? super T> longFunction);
@Override
ReversibleShortIterable collectShort(ShortFunction<? super T> shortFunction);
@Override
<V> ReversibleIterableMultimap<V, T> groupBy(Function<? super T, ? extends V> function);
@Override
<V> ReversibleIterableMultimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function);
@Override
<S> ReversibleIterable<Pair<T, S>> zip(Iterable<S> that);
@Override
ReversibleIterable<Pair<T, Integer>> zipWithIndex();
}