spring-hateoas-ext/src/main/java/de/escalon/hypermedia/spring/uber/AbstractUberNode.java
@Override
    public Iterator<UberNode> iterator() {

        return new Iterator<UberNode>() {

            int index = 0;

            @Override
            public void remove() {
                throw new UnsupportedOperationException("removing from uber node is not supported");
            }

            @Override
            public UberNode next() {
                index = findNextChildWithData();
                return data.get(index++);
            }

            @Override
            public boolean hasNext() {
                return findNextChildWithData() != -1;
            }

            private int findNextChildWithData() {
                for (int i = index; i < data.size(); i++) {
                    if (!data.get(i)
                            .getData()
                            .isEmpty()) {
                        return i;
                    }
                }
                return -1;
            }
        };
    }
@Override
    public Iterator<UberNode> iterator() {

        return new Iterator<UberNode>() {

            int index = 0;

            @Override
            public void remove() {
                throw new UnsupportedOperationException("removing from uber node is not supported");
            }

            @Override
            public UberNode next() {
                index = findNextChildWithData();
                return data.get(index++);
            }

            @Override
            public boolean hasNext() {
                return findNextChildWithData() != -1;
            }

            private int findNextChildWithData() {
                for (int i = index; i < data.size(); i++) {
                    if (!data.get(i)
                            .getData()
                            .isEmpty()) {
                        return i;
                    }
                }
                return -1;
            }
        };
    }
@ Override public Iterator < UberNode > iterator ( ) { return new Iterator < UberNode > ( ) { int index = 0 ; @ Override public void remove ( ) { throw new UnsupportedOperationException ( "removing from uber node is not supported" ) ; } @ Override public UberNode next ( ) { index = findNextChildWithData ( ) ; return data . get ( index ++ ) ; } @ Override public boolean hasNext ( ) { return findNextChildWithData ( ) != - 1 ; } private int findNextChildWithData ( ) { for ( int i = index ; i < data . size ( ) ; i ++ ) { if ( ! data . get ( i ) . getData ( ) . isEmpty ( ) ) { return i ; } } return - 1 ; } } ; }
Allows iterating over children of this uber node which have a data attribute.
Allows iterating over children of this uber node which have a data attribute .