code: public static <V> FlatTreeNode<V> of(final Tree<? extends V, ?> tree) {
  		requireNonNull(tree);
  
  		final int size = tree.size();
  		final MSeq<V> elements = MSeq.ofLength(size);
  		final int[] childOffsets = new int[size];
  		final int[] childCounts = new int[size];
  
  		assert size >= 1;
  		final FlatTreeNode<V> root = new FlatTreeNode<>(
  			0,
  			elements,
  			childOffsets,
  			childCounts
  		);
  
  		int childOffset = 1;
  		int index = 0;
  		final Iterator<? extends Tree<? extends V, ?>> it =
  			tree.breadthFirstIterator();
  
  		while (it.hasNext()) {
  			final Tree<? extends V, ?> node = it.next();
  
  			elements.set(index, node.getValue());
  			childCounts[index] = node.childCount();
  			childOffsets[index] = node.isLeaf() ? -1 : childOffset;
  
  			childOffset += node.childCount();
  			++index;
  		}
  
  		return root;
  	}
docs: Create a new {@code FlatTreeNode} from the given {@code tree}.
  
  @param tree the source tree
  @param <V> the tree value types
  @return a new {@code FlatTreeNode} from the given {@code tree}
  @throws NullPointerException if the given {@code tree} is {@code null}