package ru.job4j.iterators;

import java.util.Iterator;

/**
 * Implements iterator for even numbers.
 *
 * @author abondarev.
 * @since 26.08.2017.
 */
public class EvenIterator implements Iterator {

    /**
     * The array for iteration.
     */
    private int[] values;

    /**
     * The pointer on position of element.
     */
    private int position;

    /**
     * The constructor takes as parameter an array for iteration.
     *
     * @param values an array for iteration.
     */
    public EvenIterator(int[] values) {
        this.values = values;
    }

    /**
     * Returns true if next element exist and it is even.
     *
     * @return true if next element exist and it is even.
     */
    @Override
    public boolean hasNext() {
        return this.position < this.values.length
                && this.values[position] % 2 == 0;
    }

    /**
     * Returns element from array in wrapper or null if element not found.
     *
     * @return element from array in wrapper or null if element not found.
     */
    @Override
    public Integer next() {
        Integer result = null;
        for (; this.position < this.values.length; this.position++) {
            if (values[position] % 2 == 0) {
                result = values[position];
                break;
            }
        }
        return result;
    }
}

@@ -763,28 +763,61 @@
     
-return this.
+boolean result = false;%0A        for (int i = 
 position
  %3C t
@@ -804,32 +804,35 @@
 int i = position
+; i
  %3C this.values.l
@@ -836,21 +836,25 @@
 s.length
-%0A    
+; i++) %7B%0A
         
@@ -861,11 +861,12 @@
     
-&& 
+if (
 this
@@ -869,32 +869,25 @@
 this.values%5B
-position
+i
 %5D %25 2 == 0;%0A
@@ -884,16 +884,119 @@
 %25 2 == 0
+) %7B%0A                result = true;%0A                break;%0A            %7D%0A        %7D%0A        return result
 ;%0A    %7D%0A

Fix method hasNext() of EvenIterator class. Task #150