Skip to content

Commit

Permalink
Deprecate DropIterator as it is inlineable with new SelectIterator<T>…
Browse files Browse the repository at this point in the history
…(iterable.iterator(), new DropIterablePredicate<T>(count)).

Signed-off-by: Nikhil Nanivadekar <nikhil.nanivadekar@gs.com>
  • Loading branch information
nikhilnanivadekar committed Apr 28, 2016
1 parent 4caba0d commit 0e6bf0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.eclipse.collections.impl.block.procedure.IfObjectIntProcedure;
import org.eclipse.collections.impl.block.procedure.IfProcedure;
import org.eclipse.collections.impl.block.procedure.IfProcedureWith;
import org.eclipse.collections.impl.lazy.iterator.DropIterator;
import org.eclipse.collections.impl.lazy.iterator.SelectIterator;
import org.eclipse.collections.impl.utility.Iterate;

/**
Expand Down Expand Up @@ -88,6 +88,6 @@ public T detect(Predicate<? super T> predicate)

public Iterator<T> iterator()
{
return new DropIterator<T>(this.adapted, this.count);
return new SelectIterator<T>(this.adapted.iterator(), new DropIterablePredicate<T>(this.count));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
import java.util.Iterator;

import net.jcip.annotations.Immutable;
import org.eclipse.collections.api.block.predicate.Predicate;
import org.eclipse.collections.impl.block.predicate.DropIterablePredicate;

/**
* Iterates over the elements of the iterator skipping the first count elements or the full iterator if the count is
* non-positive.
*
* @deprecated in 8.0. Use {@link SelectIterator#SelectIterator(Iterable, Predicate)} with {@link DropIterablePredicate#DropIterablePredicate(int)} as a predicate instead.
*/
@Immutable
@Deprecated
public final class DropIterator<T> implements Iterator<T>
{
private final Iterator<T> delegateIterator;
Expand Down

0 comments on commit 0e6bf0e

Please sign in to comment.