ConcurrentModificationException при попытке добавить массив в список

Есть часть кода. никак не соображу как после проверки списка добавить массив в список. Выбрасывает исключение ConcurrentModificationException. Iterator не помогает.

private static ArrayList<int[]> list = new ArrayList<>();
private static ListIterator<int[]> iter = list.listIterator();

protected static void getCords() {
    Random rand = new Random();
    int[] cord = new int[COUNT *2];
    while (COUNT > 0){
        int i = rand.nextInt(100);
        int j = rand.nextInt(100);
        cord[0] = i;
        cord[1] = j;
        if (list.isEmpty()){
            list.add(cord);
            COUNT--;
        } else{
            while (iter.hasNext()){
                int[] check = iter.next();
                if (((check[0] - cord[0]) > 1 || (check[0] - cord[0]) < -1) || ((check[1] - cord[1]) > 1 || (check[1] - cord[1]) < -1)){
                    iter.add(cord);
                    COUNT--;
                }
            }
        }

    }

}

Ответы (0 шт):