package ru.job4j;

import java.util.*;
/**
 * Task 4.1.3
 * Create iterator for simple numbers
 *
 * @author Anton Vasilyuk
 * @version 1.0
 * @since 0.1
 */
public class IteratorSimpleNumbers implements Iterator{

    /**.
     * @index is index array
     */
    private int index = 0;

    /**.
     * @value is array numbers
     */
    private int[] value;

    /**.
     * Constructor for class Iterator SimpleNumbers
     * @param value is array numbers
     */
    public IteratorSimpleNumbers(int[] value) {
        this.value = value;
    }

    /**.
     * Method for check next member array
     * @return is there a next element
     */
    @Override
    public boolean hasNext() {
        return this.value.length > index;
    }

    /**.
     * Method for output next simple number
     * @return simple number
     */
    @Override
    public Object next() {
        int num = 0;
        while (hasNext()) {
            for (int i = 2; i < this.value[index]; i++) {
                if((this.value[index] % i) == 0) {num++;}
            }
            if(num == 0){break;}
            index++;
            num = 0;
        }
    return this.value[index++];
    }
}
@@ -692,31 +692,156 @@
 ) %7B%0A        
-return 
+boolean result = true;%0A        if (this.value == null) %7Bthrow new NoSuchElementException(%22In this array not element%22);%7D%0A        if (
 this.value.l
@@ -850,15 +850,290 @@
 gth 
-%3E
+%3C
  index
+) %7Bresult = false;%7D%0A        int num = 0;%0A        for (int i = 0; i %3C value.length; i++) %7B%0A            for(int j = 2; j %3C value.length; j++) %7B%0A                if((value%5Bi%5D %25 j) == 0) %7Bnum++;%7D%0A            %7D%0A        %7D%0A        if (num %3E 0) %7Bresult = false;%7D%0A        return result
 ;%0A  

add file for chapter_003_4.1.3