MCPcopy Create free account
hub / github.com/Teneted/Tenet / flatMap

Method flatMap

src/main/java/net/minecraftforge/fml/OptionalMod.java:168–175  ·  view source on GitHub ↗

If a value is present, apply the provided Optional-bearing mapping function to it, return that result, otherwise return an empty Optional. This method is similar to #map(Function), but the provided mapper is one whose result is already an Optional, and if invoked, {@

(Function<? super T, Optional<U>> mapper)

Source from the content-addressed store, hash-verified

166 * a null result
167 */
168 public<U> Optional<U> flatMap(Function<? super T, Optional<U>> mapper) {
169 Objects.requireNonNull(mapper);
170 if (!isPresent())
171 return Optional.empty();
172 else {
173 return Objects.requireNonNull(mapper.apply(getValue()));
174 }
175 }
176
177 /**
178 * Return the mod object if present, otherwise return {@code other}.

Callers 15

gatherFluidTexturesMethod · 0.45
allRotationsMethod · 0.45
findObjectHoldersMethod · 0.45
buildLookupsMethod · 0.45
loadVisibilityMethod · 0.45
injectCapabilitiesMethod · 0.45
ModLoaderMethod · 0.45
ModListMethod · 0.45
getGuiFactoryForMethod · 0.45

Calls 4

isPresentMethod · 0.95
getValueMethod · 0.95
applyMethod · 0.65
emptyMethod · 0.45

Tested by

no test coverage detected