@Override
  public Iterator<E> iterator() {
    var result =
        new Iterator<E>() {
          final Deque<NodeWalker<E>> stack = new ArrayDeque<>();
          E next;
          E last;

          @Override
          public boolean hasNext() {
            return next != null;
          }

          @Override
          public E next() {
            if (next == null) {
              throw new NoSuchElementException();
            }
            last = next;
            advance();
            return last;
          }

          @Override
          public void remove() {
            BytesTrieSet.this.remove(last);
          }

          void advance() {
            while (!stack.isEmpty()) {
              NodeWalker<E> thisStep = stack.peek();
              var nextStep = thisStep.nextNodeWalker();
              if (nextStep == null) {
                stack.pop();
                if (thisStep.thisNode() != null) {
                  next = thisStep.thisNode();
                  return;
                }
              } else {
                stack.push(nextStep);
              }
            }
            next = null;
          }
        };
    if (root != null) {
      result.stack.add(new NodeWalker<>(root));
    }
    result.advance();
    return result;
  }
Create a BytesTrieSet with a fixed length

@param byteLength length in bytes of the stored types
evm/src/main/java/org/hyperledger/besu/collections/trie/BytesTrieSet.java