public static <T> Iterator<T> asReadOnlyIterator(Iterator<T> iterator) {
        if (iterator instanceof UnmodifiableIterator) {
            return iterator;
        }

        return new UnmodifiableIterator<>() {
            @Override
            public boolean hasNext() {
                return iterator.hasNext();
            }

            @Override
            public T next() {
                return iterator.next();
            }
        };
    }
@Test
    public void test_asReadOnlyIterator_returns_same_iterator_when_given_iterator_is_read_only() {
        Iterator<Integer> iterator = IterableUtil.asReadOnlyIterator(numbers.iterator());

        assertTrue(iterator == IterableUtil.asReadOnlyIterator(iterator));
    }