MCPcopy Create free account
hub / github.com/traneio/future / flatten

Method flatten

future-java/src/main/java/io/trane/future/Future.java:192–192  ·  view source on GitHub ↗

Flattens a nested future. The usage of this method indicates a code smell: a map may have been used instead of flatMap. There are genuine scenarios where flatten is required, though. @param fut the nested future @param the type of the future result @return the flat future

(final Future<Future<T>> fut)

Source from the content-addressed store, hash-verified

190 * @return the flat future
191 */
192 public static <T> Future<T> flatten(final Future<Future<T>> fut) {
193 return fut.flatMap(f -> f);
194 }
195

Callers 2

flattenMethod · 0.95
isolateMethod · 0.95

Calls

no outgoing calls

Tested by 1

flattenMethod · 0.76