public static <E> ListIterator<E> decorate(ListIterator<E> iterator) {
        if (iterator == null) {
            throw new IllegalArgumentException("ListIterator must not be null");
        }
        if (iterator instanceof Unmodifiable) {
            return iterator;
        }
        return new UnmodifiableListIterator<E>(iterator);
    }
Decorates the specified iterator such that it cannot be modified.

@param iterator the iterator to decorate
@throws IllegalArgumentException if the iterator is null
jphp-runtime/src/php/runtime/common/collections/iterators/UnmodifiableListIterator.java