From f51f6da7319787348c38b875652b5c0e9f88c8aa Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:43:13 -0400 Subject: Cleanup pass Pass to do some cleanups --- src/main/java/bjc/data/QueuedIterator.java | 77 ++++++++++++++++-------------- 1 file changed, 40 insertions(+), 37 deletions(-) (limited to 'src/main/java/bjc/data/QueuedIterator.java') diff --git a/src/main/java/bjc/data/QueuedIterator.java b/src/main/java/bjc/data/QueuedIterator.java index ebacb52..f10014e 100644 --- a/src/main/java/bjc/data/QueuedIterator.java +++ b/src/main/java/bjc/data/QueuedIterator.java @@ -6,10 +6,11 @@ import java.util.Iterator; /** * An iterator that supports queuing elements after/before the current iterator; - * + * * @author bjculkin * - * @param The type of element this iterator iterates over + * @param + * The type of element this iterator iterates over */ public class QueuedIterator implements Iterator { private Iterator cur; @@ -18,7 +19,7 @@ public class QueuedIterator implements Iterator { /** * Static method for constructing iterators. - * + * * @return A queued iterator. */ public static QueuedIterator queued() { @@ -27,9 +28,9 @@ public class QueuedIterator implements Iterator { /** * Static method for constructing iterators. - * + * * @param vals - * The values to iterate over. + * The values to iterate over. * * @return A queued iterator. */ @@ -40,9 +41,9 @@ public class QueuedIterator implements Iterator { /** * Static method for constructing iterators. - * + * * @param itrs - * The iterators to use. + * The iterators to use. * * @return A queued iterator over the provided iterators. */ @@ -53,9 +54,9 @@ public class QueuedIterator implements Iterator { /** * Static method for constructing iterators. - * + * * @param itrs - * The iterables to use. + * The iterables to use. * * @return A queued iterator over the provided iterables. */ @@ -73,9 +74,9 @@ public class QueuedIterator implements Iterator { /** * Create a new queued iterator with a set of initial sources. - * + * * @param inits - * The set of initial iterators to use. + * The set of initial iterators to use. */ @SafeVarargs public QueuedIterator(Iterator... inits) { @@ -88,9 +89,9 @@ public class QueuedIterator implements Iterator { /** * Create a new queued iterator with a set of initial sources. - * + * * @param inits - * The set of initial iterables to use. + * The set of initial iterables to use. */ @SafeVarargs public QueuedIterator(Iterable... inits) { @@ -103,9 +104,9 @@ public class QueuedIterator implements Iterator { /** * Create a new queued iterator with a set of initial values. - * + * * @param vals - * The set of initial values to use. + * The set of initial values to use. */ @SafeVarargs public QueuedIterator(E... vals) { @@ -114,9 +115,9 @@ public class QueuedIterator implements Iterator { /** * Add a new iterator who we will iterate through first. - * + * * @param itr - * The iterator to go through first. + * The iterator to go through first. */ public void before(Iterator itr) { pending.push(cur); @@ -126,19 +127,19 @@ public class QueuedIterator implements Iterator { /** * Add a new iterable who we will iterate through first. - * + * * @param itr - * The iterable to go through first. + * The iterable to go through first. */ public void before(Iterable itr) { before(itr.iterator()); } - + /** * Add a new set of values who we will iterate through first. - * + * * @param vals - * Values to iterate over first. + * Values to iterate over first. */ public void before(@SuppressWarnings("unchecked") E... vals) { before(new ArrayIterator<>(vals)); @@ -146,9 +147,9 @@ public class QueuedIterator implements Iterator { /** * Add a new iterator who we will iterate through next. - * + * * @param itr - * The iterator to go through next. + * The iterator to go through next. */ public void after(Iterator itr) { pending.push(itr); @@ -156,9 +157,9 @@ public class QueuedIterator implements Iterator { /** * Add a new iterable who we will iterate through next. - * + * * @param itr - * The iterable to go through next. + * The iterable to go through next. */ public void after(Iterable itr) { after(itr.iterator()); @@ -166,19 +167,19 @@ public class QueuedIterator implements Iterator { /** * Add a new set of values who we will iterate through next. - * + * * @param vals - * The values to iterate over next. + * The values to iterate over next. */ public void after(@SuppressWarnings("unchecked") E... vals) { after(new ArrayIterator<>(vals)); } - + /** * Add a new iterator who we will iterate through last. - * + * * @param itr - * The iterator to go through last. + * The iterator to go through last. */ public void last(Iterator itr) { pending.add(itr); @@ -186,9 +187,9 @@ public class QueuedIterator implements Iterator { /** * Add a new iterable who we will iterate through last. - * + * * @param itr - * The iterable to go through last. + * The iterable to go through last. */ public void last(Iterable itr) { last(itr.iterator()); @@ -196,9 +197,9 @@ public class QueuedIterator implements Iterator { /** * Add a new set of values who we will iterate through last. - * + * * @param vals - * The values we will iterate over. + * The values we will iterate over. */ public void last(@SuppressWarnings("unchecked") E... vals) { last(new ArrayIterator<>(vals)); @@ -207,7 +208,8 @@ public class QueuedIterator implements Iterator { @Override public boolean hasNext() { while (cur == null || !cur.hasNext()) { - if (pending.isEmpty()) return false; + if (pending.isEmpty()) + return false; cur = pending.pop(); } @@ -218,7 +220,8 @@ public class QueuedIterator implements Iterator { @Override public E next() { while (cur == null || !cur.hasNext()) { - if (pending.isEmpty()) return null; + if (pending.isEmpty()) + return null; cur = pending.pop(); } -- cgit v1.2.3