chapter_003/src/main/java/ru/job4j/list/SimplLinkedList.java
@Override
    public synchronized Iterator iterator() {
        return new Iterator() {
            /**
             * Head of list.
             */
            private Node currentIterNod;
            @Override
            public boolean hasNext() {
                if (currentIterNod == null) {
                    currentIterNod = SimplLinkedList.this.head;
                }
                return (currentIterNod != null) && (currentIterNod.next != null);
            }

            @Override
            public T next() {
                if (!hasNext()) {
                    throw new NoSuchElementException("ups");
                }
                currentIterNod = currentIterNod.next;
                return (T) currentIterNod.value;
            }
        };
    }
/**
     * Override Iterator.
     *
     * @return Iterator Iterator
     */
Override Iterator.
@return Iterator Iterator
Override Iterator . @return Iterator Iterator
@Override
    public synchronized Iterator iterator() {
        return new Iterator() {
            /**
             * Head of list.
             */
            private Node currentIterNod;
            @Override
            public boolean hasNext() {
                if (currentIterNod == null) {
                    currentIterNod = SimplLinkedList.this.head;
                }
                return (currentIterNod != null) && (currentIterNod.next != null);
            }
            @Override
            public T next() {
                if (!hasNext()) {
                    throw new NoSuchElementException("ups");
                }
                currentIterNod = currentIterNod.next;
                return (T) currentIterNod.value;
            }
        };
    }
@ Override public synchronized Iterator iterator ( ) { return new Iterator ( ) { /**
             * Head of list.
             */ private Node currentIterNod ; @ Override public boolean hasNext ( ) { if ( currentIterNod == null ) { currentIterNod = SimplLinkedList . this . head ; } return ( currentIterNod != null ) && ( currentIterNod . next != null ) ; } @ Override public T next ( ) { if ( ! hasNext ( ) ) { throw new NoSuchElementException ( "ups" ) ; } currentIterNod = currentIterNod . next ; return ( T ) currentIterNod . value ; } } ; }
Override Iterator.
Override Iterator .