### Question:
HashTree { public Stream<Bytes32> breadthFirstStream() { return createBreadthFirstStream(rootHash); } private  HashTree(
      final Bytes32 rootHash,
      final Map<Bytes32, Bytes32> childToParent,
      final Map<Bytes32, Set<Bytes32>> parentToChildren); static Builder builder(); Builder updater(); Builder withRoot(final Bytes32 newRootHash); Bytes32 getRootHash(); Optional<Bytes32> getParent(final Bytes32 childRoot); Set<Bytes32> getAllRoots(); void processHashesInChain(final Bytes32 head, NodeProcessor processor); List<Bytes32> collectChainRoots(
      final Bytes32 head, Function<Bytes32, Boolean> shouldContinue); void processHashesInChainWhile(final Bytes32 head, HaltableNodeProcessor nodeProcessor); int countChildren(final Bytes32 hash); boolean contains(final Bytes32 blockRoot); int size(); Stream<Bytes32> preOrderStream(); Stream<Bytes32> breadthFirstStream(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void breadthFirstStream() { final HashTree blockTree = HashTree.builder() .rootHash(Bytes32.fromHexString("0x00")) .childAndParentRoots(Bytes32.fromHexString("0x0000"), Bytes32.fromHexString("0x9999")) .childAndParentRoots(Bytes32.fromHexString("0x001A"), Bytes32.fromHexString("0x0000")) .childAndParentRoots(Bytes32.fromHexString("0x002A"), Bytes32.fromHexString("0x001A")) .childAndParentRoots(Bytes32.fromHexString("0x003A"), Bytes32.fromHexString("0x002A")) .childAndParentRoots(Bytes32.fromHexString("0x001B"), Bytes32.fromHexString("0x0000")) .childAndParentRoots(Bytes32.fromHexString("0x002B"), Bytes32.fromHexString("0x001B")) .childAndParentRoots(Bytes32.fromHexString("0x003B"), Bytes32.fromHexString("0x002B")) .childAndParentRoots(Bytes32.fromHexString("0x001C"), Bytes32.fromHexString("0x0000")) .childAndParentRoots(Bytes32.fromHexString("0x002C"), Bytes32.fromHexString("0x001C")) .childAndParentRoots(Bytes32.fromHexString("0x003C"), Bytes32.fromHexString("0x002C")) .build(); final List<Bytes32> ordered = blockTree.breadthFirstStream().collect(Collectors.toList()); assertThat(ordered) .containsExactly( Bytes32.fromHexString("0x0000"), Bytes32.fromHexString("0x001A"), Bytes32.fromHexString("0x001B"), Bytes32.fromHexString("0x001C"), Bytes32.fromHexString("0x002A"), Bytes32.fromHexString("0x002B"), Bytes32.fromHexString("0x002C"), Bytes32.fromHexString("0x003A"), Bytes32.fromHexString("0x003B"), Bytes32.fromHexString("0x003C")); }