private List<DTNode<I>> closeTransitions(TransList<I> transList, boolean hard) {

        final List<AbstractHypTrans<I>> transToSift = new ArrayList<>(transList.size());

        AbstractHypTrans<I> t;
        while ((t = transList.poll()) != null) {
            if (!t.isTree()) {
                transToSift.add(t);
            }
        }

        if (transToSift.isEmpty()) {
            return Collections.emptyList();
        }

        final Iterator<DTNode<I>> leavesIter = updateDTTargets(transToSift, hard).iterator();
        final List<DTNode<I>> result = new ArrayList<>(transToSift.size());

        for (final AbstractHypTrans<I> transition : transToSift) {
            final DTNode<I> node = leavesIter.next();
            if (node.isLeaf() && node.getData() == null && transition.getNextElement() == null) {
                result.add(node);
            }
        }

        assert !leavesIter.hasNext();
        return result;
    }
private List < DTNode < I > > closeTransitions ( TransList < I > transList , boolean hard ) { final List < AbstractHypTrans < I > > transToSift = new ArrayList < > ( transList . size ( ) ) ; AbstractHypTrans < I > t ; while ( ( t = transList . poll ( ) ) != null ) { if ( ! t . isTree ( ) ) { transToSift . add ( t ) ; } } if ( transToSift . isEmpty ( ) ) { return Collections . emptyList ( ) ; } final Iterator < DTNode < I > > leavesIter = updateDTTargets ( transToSift , hard ) . iterator ( ) ; final List < DTNode < I > > result = new ArrayList < > ( transToSift . size ( ) ) ; for ( final AbstractHypTrans < I > transition : transToSift ) { final DTNode < I > node = leavesIter . next ( ) ; if ( node . isLeaf ( ) && node . getData ( ) == null && transition . getNextElement ( ) == null ) { result . add ( node ) ; } } assert ! leavesIter . hasNext ( ) ; return result ; }
Ensures that the specified transitions point to a leaf-node. If a transition is a tree transition, this method
has no effect.
<p>
The provided transList is consumed in this process.
<p>
If a transition needs sifting, the reached leaf node will be collected in the returned collection.

@param transList
the list of transitions

@return a collection containing the reached leaves of transitions that needed sifting