Skip to content

Commit 4b957c1

Browse files
author
vsilaev
committed
Fix misspelled name of the CloseableIterator
1 parent 7617476 commit 4b957c1

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

net.tascalate.javaflow.examples/src/main/java/org/apache/commons/javaflow/examples/lambdas/LambdasExampleMinimalIterator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package org.apache.commons.javaflow.examples.lambdas;
1717

1818
import org.apache.commons.javaflow.api.Continuation;
19-
import org.apache.commons.javaflow.extras.ClosableIterator;
19+
import org.apache.commons.javaflow.extras.CloseableIterator;
2020
import org.apache.commons.javaflow.extras.Continuations;
2121

2222
public class LambdasExampleMinimalIterator {
@@ -39,7 +39,7 @@ public static void main(String[] argv) throws Exception {
3939
// use try-with-resources to close the coIterator
4040
// (and hence terminate underlying continuation)
4141
// in case of early exit
42-
try (ClosableIterator<Integer> i = Continuations.iterate(cc)) {
42+
try (CloseableIterator<Integer> i = Continuations.iterate(cc)) {
4343
int c = 0;
4444
while (i.hasNext()) {
4545
System.out.println("Interrupted " + i.next());
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@
1515
*/
1616
package org.apache.commons.javaflow.extras;
1717

18+
import java.io.Closeable;
1819
import java.util.Iterator;
1920

2021
/**
21-
* Iterator that additionally implements {@link Closable} interface
22+
* Iterator that additionally implements {@link Closeable} interface
2223
* to execute clean-up when not fully iterated
2324
*
2425
* @author vsilaev
2526
*
2627
* @param <E>
2728
* Type of objects returned by the iterator
2829
*/
29-
public interface ClosableIterator<E> extends Iterator<E>, AutoCloseable {
30+
public interface CloseableIterator<E> extends Iterator<E>, AutoCloseable {
3031
@Override
3132
void close();
3233
}

net.tascalate.javaflow.extras/src/main/java/org/apache/commons/javaflow/extras/CoIterator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param <E>
4444
* Type of objects returned by the iterator
4545
*/
46-
public class CoIterator<E> implements ClosableIterator<E>, Serializable {
46+
public class CoIterator<E> implements CloseableIterator<E>, Serializable {
4747
private static final long serialVersionUID = 1L;
4848

4949
private boolean advance;

net.tascalate.javaflow.extras/src/main/java/org/apache/commons/javaflow/extras/Continuations.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ public static Continuation start(ContinuableRunnable o) {
6666
return Continuation.startWith(toRunnable(o));
6767
}
6868

69-
public static <T> ClosableIterator<T> iterate(Continuation continuation) {
69+
public static <T> CloseableIterator<T> iterate(Continuation continuation) {
7070
return iterate(continuation, false);
7171
}
7272

73-
public static <T> ClosableIterator<T> iterate(Continuation continuation, boolean useCurrentValue) {
73+
public static <T> CloseableIterator<T> iterate(Continuation continuation, boolean useCurrentValue) {
7474
return new CoIterator<>(continuation, useCurrentValue);
7575
}
7676

7777

78-
public static <T> ClosableIterator<T> iterate(ContinuableRunnable generator) {
78+
public static <T> CloseableIterator<T> iterate(ContinuableRunnable generator) {
7979
return iterate(create(generator), false);
8080
}
8181

@@ -84,7 +84,7 @@ public static <T> Stream<T> stream(Continuation continuation) {
8484
}
8585

8686
public static <T> Stream<T> stream(Continuation continuation, boolean useCurrentValue) {
87-
ClosableIterator<T> iterator = iterate(continuation, useCurrentValue);
87+
CloseableIterator<T> iterator = iterate(continuation, useCurrentValue);
8888
return StreamSupport
8989
.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false)
9090
.onClose(iterator::close);
@@ -118,7 +118,7 @@ public static <T> void execute(Continuation continuation, Consumer<? super T> ac
118118
* @param action a non-continuable action to perform on the values yielded
119119
*/
120120
public static <T> void execute(Continuation continuation, boolean useCurrentValue, Consumer<? super T> action) {
121-
try (ClosableIterator<T> iter = iterate(continuation, useCurrentValue)) {
121+
try (CloseableIterator<T> iter = iterate(continuation, useCurrentValue)) {
122122
while (iter.hasNext()) {
123123
action.accept(iter.next());
124124
}
@@ -161,7 +161,7 @@ public static <T> void execute(ContinuableRunnable generator, Consumer<? super T
161161
* @param action a continuable action to perform on the values yielded
162162
*/
163163
public @continuable static <T> void executeContinuable(Continuation continuation, boolean useCurrentValue, ContinuableConsumer<? super T> action) {
164-
try (ClosableIterator<T> iter = iterate(continuation, useCurrentValue)) {
164+
try (CloseableIterator<T> iter = iterate(continuation, useCurrentValue)) {
165165
forEach(iter, action);
166166
}
167167
}
@@ -205,7 +205,7 @@ public static <T> void execute(ContinuableRunnable generator, Consumer<? super T
205205
*/
206206
public @continuable static <T> void forEach(Iterable<T> iterable, ContinuableConsumer<? super T> action) {
207207
Iterator<T> iter = iterable.iterator();
208-
try (ClosableIterator<T> closable = asClosable(iter)) {
208+
try (CloseableIterator<T> closeable = asCloseable(iter)) {
209209
forEach(iter, action);
210210
}
211211
}
@@ -227,8 +227,8 @@ public static <T> void execute(ContinuableRunnable generator, Consumer<? super T
227227
}
228228

229229
@SuppressWarnings("unchecked")
230-
private static <E> ClosableIterator<E> asClosable(Object o) {
231-
return o instanceof ClosableIterator ? (ClosableIterator<E>)o : null;
230+
private static <E> CloseableIterator<E> asCloseable(Object o) {
231+
return o instanceof CloseableIterator ? (CloseableIterator<E>)o : null;
232232
}
233233

234234
}

0 commit comments

Comments
 (0)