@SuppressWarnings("unchecked")
    public static <E extends Document> Stream<E> childrenOf(
        final Document document,
        final BiFunction<Document, Map<String, Object>, E> childConstructor) {
        
        requireNonNull(document);
        requireNonNull(childConstructor);
        
        return document.getData().values().stream()
            .filter(obj -> obj instanceof List<?>)
            .map(list -> (List<Object>) list)
            .flatMap(Collection::stream)
            .filter(obj -> obj instanceof Map<?, ?>)
            .map(map -> (Map<String, Object>) map)
            .map(map -> childConstructor.apply(document, map));
    }
Returns a stream of child documents to a specified document by using the
supplied constructor.

@param <E>               the expected child type
@param document          the parent document
@param childConstructor  child constructor
@return                  stream of children
runtime-parent/runtime-config/src/main/java/com/speedment/runtime/config/util/DocumentUtil.java