File tree Expand file tree Collapse file tree
kilo-client/src/main/java/org/httprpc/kilo/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,12 +41,14 @@ private static class FilterIterator<T> implements Iterator<T> {
4141 public boolean hasNext () {
4242 if (hasNext == null ) {
4343 hasNext = Boolean .FALSE ;
44+ next = null ;
4445
4546 while (iterator .hasNext ()) {
46- next = iterator .next ();
47+ var element = iterator .next ();
4748
48- if (predicate .test (next )) {
49+ if (predicate .test (element )) {
4950 hasNext = Boolean .TRUE ;
51+ next = element ;
5052
5153 break ;
5254 }
Original file line number Diff line number Diff line change @@ -41,26 +41,26 @@ public class Pipe<E> implements Iterable<E> {
4141 public boolean hasNext () {
4242 if (hasNext == null ) {
4343 hasNext = Boolean .FALSE ;
44+ next = null ;
4445
45- Object next ;
46+ Object value ;
4647 try {
4748 if (timeout == 0 ) {
48- next = queue .take ();
49+ value = queue .take ();
4950 } else {
50- next = queue .poll (timeout , TimeUnit .MILLISECONDS );
51+ value = queue .poll (timeout , TimeUnit .MILLISECONDS );
5152
52- if (next == null ) {
53+ if (value == null ) {
5354 throw new TimeoutException ("Poll timed out." );
5455 }
5556 }
5657 } catch (InterruptedException exception ) {
5758 throw new RuntimeException (exception );
5859 }
5960
60- if (next != TERMINATOR ) {
61+ if (value != TERMINATOR ) {
6162 hasNext = Boolean .TRUE ;
62-
63- this .next = (E )next ;
63+ next = (E )value ;
6464 }
6565 }
6666
You can’t perform that action at this time.
0 commit comments