Return a new Streamlet by applying flatMapFn to each element of this Streamlet and
flattening the result
@param flatMapFn The FlatMap Function that should be applied to each element
764680
@Override
  public <T> Streamlet<T> flatMap(
      SerializableFunction<R, ? extends Iterable<? extends T>> flatMapFn) {
    checkNotNull(flatMapFn, "flatMapFn cannot be null");

    FlatMapStreamlet<R, T> retval = new FlatMapStreamlet<>(this, flatMapFn);
    addChild(retval);
    return retval;
  }
1158847
@Override
  public Streamlet<R> union(Streamlet<? extends R> otherStreamlet) {
    checkNotNull(otherStreamlet, "otherStreamlet cannot be null");

    StreamletImpl<? extends R> joinee = (StreamletImpl<? extends R>) otherStreamlet;
    UnionStreamlet<R> retval = new UnionStreamlet<>(this, joinee);
    addChild(retval);
    joinee.addChild(retval);
    return retval;
  }
590144
public <B> StreamT<W,B> flatMapT(final Function<? super T, StreamT<W,B>> f) {

        return of(run.map(list -> list.flatMap(a -> f.apply(a).run.stream())
                                      .flatMap(a -> a)));
    }
1189712
@Override
    public List<String> applyToMap( Map<String, Object> inputMap ) {
        if ( inputMap == null ) {
            return null;
        }

        List<String> keysToBeRemoved = new LinkedList<>();

        if ( pathElement instanceof LiteralPathElement ) {

            // if we are a literal, check to see if we match
            if ( inputMap.containsKey( pathElement.getRawKey() ) ) {
                keysToBeRemoved.add( pathElement.getRawKey() );
            }
        }
        else if ( pathElement instanceof StarPathElement ) {

            StarPathElement star = (StarPathElement) pathElement;

            // if we are a wildcard, check each input key to see if it matches us
            for( String key : inputMap.keySet() ) {

                if ( star.stringMatch( key ) ) {
                    keysToBeRemoved.add( key );
                }
            }
        }

        return keysToBeRemoved;
    }
811749
@Override
  public Streamlet<R> setName(String sName) {
    checkNotBlank(sName, "Streamlet name cannot be null/blank");

    this.name = sName;
    return this;
  }
592656
@Override
    public <U> MonadicBinding<U> flatMap(
            Function<? super T, ? extends ObservableValue<U>> f) {
        return EasyBind.flatMap(delegate, f);
    }
836822
public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper, TypeInformation<Vertex<K, NV>> returnType) {
		DataSet<Vertex<K, NV>> mappedVertices = vertices.map(
				new MapFunction<Vertex<K, VV>, Vertex<K, NV>>() {
					private Vertex<K, NV> output = new Vertex<>();

					public Vertex<K, NV> map(Vertex<K, VV> value) throws Exception {
						output.f0 = value.f0;
						output.f1 = mapper.map(value);
						return output;
					}
				})
				.returns(returnType)
				.withForwardedFields("f0")
					.name("Map vertices");

		return new Graph<>(mappedVertices, this.edges, this.context);
	}
551215
public <R> Change<R> map(Function<T, R> fn) {
        return new Change<>(
                fn.apply(getOldValue()),
                fn.apply(getNewValue())
        );
    }
1063423
public static <K, V> Map<K, V> newFilteredMap(Map<K, V> map,
            Predicate<? super Entry<K, V>> filter) {
        return getEntryStreamWithFilter(map, filter)
                .collect(toMap(Entry::getKey, Entry::getValue));
    }
586853
public static MapMapping createMapMapping( List<Element> inputElements ){
        if( inputElements == null || inputElements.isEmpty() ){
            return null;
        }
        MapMapping result = new MapMapping();
        for( Element element : inputElements ){
            String name = element.getString( 1 );
            result.addEntryMapping( name, createInputMapping( element.getObject( 0 ) ) );
        }
        return result;
    }
84482
@Override
	public final void flatMap(IN value, Collector<OUT> out) throws Exception {
		for (Iterator<OUT> iter = flatMap(value); iter.hasNext(); ) {
			out.collect(iter.next());
		}
	}
1211899
public <R> Set<R> flattenEntries(TriFunction<K1, K2, V, R> fn) {
    return entrySet().stream()
        .flatMap(outer -> outer.getValue().entrySet().stream()
            .map(inner -> fn.apply(outer.getKey(), inner.getKey(), inner.getValue())))
        .collect(toSet());
  }
752731
public static final <K,V> Stream<Entry<K,V>> stream(K key, NavigableMap<K,V> map, boolean parallel)
    {
        return StreamSupport.stream(spliterator(key, map), parallel);
    }
665765
public static <K, V> Func1<Iterable<Map.Entry<K, V>>, SolidMap<K, V>> toSolidMap() {
        return new Func1<Iterable<Map.Entry<K, V>>, SolidMap<K, V>>() {
            @Override
            public SolidMap<K, V> call(Iterable<Map.Entry<K, V>> iterable) {
                return new SolidMap<>(stream(iterable).map(new Func1<Map.Entry<K, V>, Pair<K, V>>() {
                    @Override
                    public Pair<K, V> call(Map.Entry<K, V> value) {
                        return new Pair<>(value.getKey(), value.getValue());
                    }
                }));
            }
        };
    }
883407
public static <T, R, C extends Collection<R>, E extends Exception> C flatMap(final T[] a, final int fromIndex, final int toIndex,
            final Try.Function<? super T, ? extends Collection<? extends R>, E> func, final IntFunction<? extends C> supplier) throws E {
        checkFromToIndex(fromIndex, toIndex, len(a));
        N.checkArgNotNull(func);

        if (N.isNullOrEmpty(a)) {
            return supplier.apply(0);
        }

        final C result = supplier.apply(toIndex - fromIndex);
        Collection<? extends R> mr = null;

        for (int i = fromIndex; i < toIndex; i++) {
            if (N.notNullOrEmpty(mr = func.apply(a[i]))) {
                result.addAll(mr);
            }
        }

        return result;
    }
459665
public static void flatCopyTo(String prefix, Map<String, Object> sourceMap,
                                  Map<String, String> dstMap) {
        for (Map.Entry<String, Object> entry : sourceMap.entrySet()) {
            String key = prefix + entry.getKey();
            Object value = entry.getValue();
            if (value instanceof String) {
                dstMap.put(key, (String) value);
            } else if (value instanceof Number) {
                dstMap.put(key, value.toString());
            } else if (value instanceof Map) {
                flatCopyTo(key + ".", (Map<String, Object>) value, dstMap);
            }
        }
    }
1304242
@Beta
    public <R, E extends Exception, E2 extends Exception> void flatMapThenForEach(final Try.Function<? super T, ? extends Collection<? extends R>, E> mapper,
            final Try.Consumer<? super R, E2> action) throws E, E2 {
        N.checkArgNotNull(mapper);
        N.checkArgNotNull(action);

        Collection<? extends R> c = null;

        for (T e : coll) {
            c = mapper.apply(e);

            if (N.notNullOrEmpty(c)) {
                for (R r : c) {
                    action.accept(r);
                }
            }
        }
    }