@SuppressWarnings({"rawtypes", "unchecked"}) protected static void flatIteration(List streams, Object o) { if (o instanceof Stream) { ((Stream<?>) o).forEach(o1 -> flatIteration(streams, o1)); } else if (o instanceof Collection) { ((Collection<?>) o).forEach(o1 -> flatIteration(streams, o1)); } else if (o instanceof HasComponents) { streams.add(o); ((HasComponents) o).components().forEach(o1 -> flatIteration(streams, o1)); } else { streams.add(o); } }
@SuppressWarnings({"rawtypes", "unchecked"}) protected static void flatIteration(List streams, Object o) { if (o instanceof Stream) { ((Stream<?>) o).forEach(o1 -> flatIteration(streams, o1)); } else if (o instanceof Collection) { ((Collection<?>) o).forEach(o1 -> flatIteration(streams, o1)); } else if (o instanceof HasComponents) { streams.add(o); ((HasComponents) o).components().forEach(o1 -> flatIteration(streams, o1)); } else { streams.add(o); } }
@SuppressWarnings({"rawtypes", "unchecked"}) protected static void flatIteration(List streams, Object o) { if (o instanceof Stream) { ((Stream<?>) o).forEach(o1 -> flatIteration(streams, o1)); } else if (o instanceof Collection) { ((Collection<?>) o).forEach(o1 -> flatIteration(streams, o1)); } else if (o instanceof HasComponents) { streams.add(o); ((HasComponents) o).components().forEach(o1 -> flatIteration(streams, o1)); } else { streams.add(o); } }
/** * @param root the root for the invisit * @return recursive invisit of all components included in the root component; includes the root * and all intermediate nodes. Streams will be flattened. */ @SuppressWarnings({"rawtypes", "unchecked"}) public static Stream<?> flatComponents(HasComponents root) { List streams = new ArrayList<>(); streams.add(root); root.components().filter(o -> o != root).forEach(o -> flatIteration(streams, o)); return streams.stream(); }
/** * @param root the root for the invisit * @return recursive invisit of all components included in the root component; includes the root * and all intermediate nodes. Streams will be flattened. */ @SuppressWarnings({"rawtypes", "unchecked"}) public static Stream<?> flatComponents(HasComponents root) { List streams = new ArrayList<>(); streams.add(root); root.components().filter(o -> o != root).forEach(o -> flatIteration(streams, o)); return streams.stream(); }
/** * @param root the root for the invisit * @return recursive invisit of all components included in the root component; includes the root * and all intermediate nodes. Streams will be flattened. */ @SuppressWarnings({"rawtypes", "unchecked"}) public static Stream<?> flatComponents(HasComponents root) { List streams = new ArrayList<>(); streams.add(root); root.components().filter(o -> o != root).forEach(o -> flatIteration(streams, o)); return streams.stream(); }