protected static void loopThroughAllNestedChildren(
            final NestedChild nestedChild, final boolean includeParents,
            final AbstractHtml... parents) {

        final Deque<Set<AbstractHtml>> childrenStack = new ArrayDeque<>();

        if (includeParents) {
            final Set<AbstractHtml> parentsSet = new HashSet<>(parents.length);
            Collections.addAll(parentsSet, parents);
            childrenStack.push(parentsSet);
        } else {
            for (final AbstractHtml parent : parents) {
                childrenStack.push(parent.children);
            }
        }

        Set<AbstractHtml> children;

        exit: while ((children = childrenStack.poll()) != null) {

            for (final AbstractHtml eachChild : children) {

                if (!nestedChild.eachChild(eachChild)) {
                    break exit;
                }

                final Set<AbstractHtml> subChildren = eachChild.children;

                if (subChildren != null && subChildren.size() > 0) {
                    childrenStack.push(subChildren);
                }
            }
        }
    }
protected static void loopThroughAllNestedChildren(
            final NestedChild nestedChild, final boolean includeParents,
            final AbstractHtml... parents) {

        final Deque<Set<AbstractHtml>> childrenStack = new ArrayDeque<>();

        if (includeParents) {
            final Set<AbstractHtml> parentsSet = new HashSet<>(parents.length);
            Collections.addAll(parentsSet, parents);
            childrenStack.push(parentsSet);
        } else {
            for (final AbstractHtml parent : parents) {
                childrenStack.push(parent.children);
            }
        }

        Set<AbstractHtml> children;

        exit: while ((children = childrenStack.poll()) != null) {

            for (final AbstractHtml eachChild : children) {

                if (!nestedChild.eachChild(eachChild)) {
                    break exit;
                }

                final Set<AbstractHtml> subChildren = eachChild.children;

                if (subChildren != null && subChildren.size() > 0) {
                    childrenStack.push(subChildren);
                }
            }
        }
    }
protected static void loopThroughAllNestedChildren ( final NestedChild nestedChild , final boolean includeParents , final AbstractHtml ... parents ) { final Deque < Set < AbstractHtml > > childrenStack = new ArrayDeque <> ( ) ; if ( includeParents ) { final Set < AbstractHtml > parentsSet = new HashSet <> ( parents . length ) ; Collections . addAll ( parentsSet , parents ) ; childrenStack . push ( parentsSet ) ; } else { for ( final AbstractHtml parent : parents ) { childrenStack . push ( parent . children ) ; } } Set < AbstractHtml > children ; exit : while ( ( children = childrenStack . poll ( ) ) != null ) { for ( final AbstractHtml eachChild : children ) { if ( ! nestedChild . eachChild ( eachChild ) ) { break exit ; } final Set < AbstractHtml > subChildren = eachChild . children ; if ( subChildren != null && subChildren . size ( ) > 0 ) { childrenStack . push ( subChildren ) ; } } } }
Loops through all nested children tags (excluding the given tag) of the
given tag. The looping is in a random order to gain maximum performance
and minimum memory footprint.

@param nestedChild
the object of NestedChild from which the
eachChild(AbstractHtml) to be invoked.
@param includeParents
true to include the given parent tags in the
loop
@param parents
the tags from which to loop through.

@since 2.1.8
@author WFF
Loops through all nested children tags ( excluding the given tag ) of the given tag . The looping is in a random order to gain maximum performance and minimum memory footprint .