doc updates.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@5449 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-10-25 17:10:50 +00:00
1 parent 743fe22290
commit e6abd726d3
2 files changed
+17

No files matched your search

@@ -5,8 +5,12 @@ import java.util.Iterator;
/**
* {@link Iterator} that adapts the values returned from another iterator.
*
* <p>
* This class should be really in {@link Iterators} but for historical reasons it's here.
*
* @author Kohsuke Kawaguchi
* @since 1.121
* @see Iterators
*/
public abstract class AdaptedIterator<T,U> implements Iterator<U> {
private final Iterator<? extends T> core;
@@ -15,6 +19,10 @@ public abstract class AdaptedIterator<T,U> implements Iterator<U> {
this.core = core;
}
protected AdaptedIterator(Iterable<? extends T> core) {
this(core.iterator());
}
public boolean hasNext() {
return core.hasNext();
}
@@ -11,6 +11,7 @@ import java.util.AbstractList;
* Varios {@link Iterator} implementations.
*
* @author Kohsuke Kawaguchi
* @see AdaptedIterator
*/
public class Iterators {
/**
@@ -59,6 +60,8 @@ public class Iterators {
/**
* Creates a filtered view of another iterator.
*
* @since 1.150
*/
public static abstract class FilterIterator<T> implements Iterator<T> {
private final Iterator<? extends T> core;
@@ -111,6 +114,8 @@ public class Iterators {
/**
* Returns the {@link Iterable} that lists items in the reverse order.
*
* @since 1.150
*/
public static <T> Iterable<T> reverse(final List<T> lst) {
return new Iterable<T>() {
@@ -137,6 +142,8 @@ public class Iterators {
* Returns a list that represents [start,end).
*
* For example sequence(1,5,1)={1,2,3,4}, and sequence(7,1,-2)={7.5,3}
*
* @since 1.150
*/
public static List<Integer> sequence(final int start, int end, final int step) {
@@ -162,6 +169,8 @@ public class Iterators {
/**
* The short cut for {@code reverse(sequence(start,end,step))}.
*
* @since 1.150
*/
public static List<Integer> reverseSequence(int start, int end, int step) {
return sequence(end-1,start-1,-step);