### Question:
TrieNodeDecoder { public static List<Node<Bytes>> decodeNodes(final Bytes nodeRlp) { Node<Bytes> node = decode(nodeRlp); List<Node<Bytes>> nodes = new ArrayList<>(); nodes.add(node); final List<Node<Bytes>> toProcess = new ArrayList<>(); toProcess.addAll(node.getChildren()); while (!toProcess.isEmpty()) { final Node<Bytes> currentNode = toProcess.remove(0); if (Objects.equals(NullNode.instance(), currentNode)) { continue; } nodes.add(currentNode); if (!currentNode.isReferencedByHash()) { toProcess.addAll(currentNode.getChildren()); } } return nodes; } private  TrieNodeDecoder(); static Node<Bytes> decode(final Bytes rlp); static List<Node<Bytes>> decodeNodes(final Bytes nodeRlp); static Stream<Node<Bytes>> breadthFirstDecoder(
      final NodeLoader nodeLoader, final Bytes32 rootHash, final int maxDepth); static Stream<Node<Bytes>> breadthFirstDecoder(
      final NodeLoader nodeLoader, final Bytes32 rootHash);  }### Answer:
@Test public void decodeNodes() { final InMemoryKeyValueStorage storage = new InMemoryKeyValueStorage(); MerklePatriciaTrie<Bytes, Bytes> trie = new StoredMerklePatriciaTrie<>( new BytesToByteNodeLoader(storage), Function.identity(), Function.identity()); trie.put(Bytes.fromHexString("0x100000"), Bytes.of(1)); trie.put(Bytes.fromHexString("0x200000"), Bytes.of(2)); trie.put(Bytes.fromHexString("0x300000"), Bytes.of(3)); trie.put(Bytes.fromHexString("0x110000"), Bytes.of(10)); trie.put(Bytes.fromHexString("0x210000"), Bytes.of(20)); trie.put( Bytes.fromHexString("0x310000"), Bytes.fromHexString("0x11223344556677889900112233445566778899")); final KeyValueStorageTransaction tx = storage.startTransaction(); trie.commit((key, value) -> tx.put(key.toArrayUnsafe(), value.toArrayUnsafe())); tx.commit(); final Bytes rootNodeRlp = Bytes.wrap(storage.get(trie.getRootHash().toArrayUnsafe()).get()); final List<Node<Bytes>> nodes = TrieNodeDecoder.decodeNodes(rootNodeRlp); assertThat(nodes.size()).isEqualTo(8); List<Bytes> actualValues = nodes.stream() .filter(n -> !n.isReferencedByHash()) .map(Node::getValue) .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.toList()); assertThat(actualValues) .containsExactlyInAnyOrder(Bytes.of(1), Bytes.of(10), Bytes.of(2), Bytes.of(20)); }