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

Method map

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

If a mod object is present, apply the provided mapping function to it, and if the result is non-null, return an Optional describing the result. Otherwise return an empty Optional. @apiNote This method supports post-processing on optional values, without the need to explicitly check

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

Source from the content-addressed store, hash-verified

140 * @throws NullPointerException if the mapping function is null
141 */
142 public<U> Optional<U> map(Function<? super T, ? extends U> mapper) {
143 Objects.requireNonNull(mapper);
144 if (!isPresent())
145 return Optional.empty();
146 else {
147 return Optional.ofNullable(mapper.apply(getValue()));
148 }
149 }
150
151 /**
152 * If a value is present, apply the provided {@code Optional}-bearing

Callers 15

tryFillContainerMethod · 0.45
tryEmptyContainerMethod · 0.45
getFluidContainedMethod · 0.45
tryPlaceFluidMethod · 0.45
isFluidEqualMethod · 0.45
fromEarlyExceptionMethod · 0.45
versionRangeToStringMethod · 0.45
buildTransitionMethod · 0.45
injectMethod · 0.45
getMessageMethod · 0.45

Calls 4

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

Tested by

no test coverage detected