code: @SuppressWarnings("unchecked")
      public static <T, TT extends T> EntryStream<Integer, T> ofTree(T root, Class<TT> collectionClass,
              BiFunction<Integer, TT, Stream<T>> mapper) {
          return ofTree(root, (d, t) -> collectionClass.isInstance(t) ? mapper.apply(d, (TT) t) : null);
      }
docs: Return a new {@link EntryStream} containing all the nodes of tree-like
  data structure in entry values along with the corresponding tree depths
  in entry keys, in depth-first order.
  
  <p>
  The keys of the returned stream are non-negative integer numbers. 0 is
  used for the root node only, 1 is for root immediate children, 2 is for
  their children and so on.
  
  <p>
  The streams created by mapper may be automatically
  {@link java.util.stream.BaseStream#close() closed} after its contents
  already consumed and unnecessary anymore. It's not guaranteed that all
  created streams will be closed during the stream terminal operation. If
  it's necessary to close all the created streams, call the {@code close()}
  method of the resulting stream returned by {@code ofTree()}.
  
  @param <T> the base type of tree nodes
  @param <TT> the sub-type of composite tree nodes which may have children
  @param root root node of the tree
  @param collectionClass a class representing the composite tree node
  @param mapper a non-interfering, stateless function to apply to each
  composite tree node and its depth which returns stream of direct
  children. May return null if the given node has no children.
  @return the new sequential ordered stream
  @since 0.5.2
  @see StreamEx#ofTree(Object, Class, Function)
  @see #ofTree(Object, BiFunction)