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

Method map

src/main/java/net/minecraftforge/fml/RegistryObject.java:194–201  ·  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

192 * @throws NullPointerException if the mapping function is null
193 */
194 public<U> Optional<U> map(Function<? super T, ? extends U> mapper) {
195 Objects.requireNonNull(mapper);
196 if (!isPresent())
197 return Optional.empty();
198 else {
199 return Optional.ofNullable(mapper.apply(get()));
200 }
201 }
202
203 /**
204 * If a value is present, apply the provided {@code Optional}-bearing

Callers

nothing calls this directly

Calls 4

isPresentMethod · 0.95
getMethod · 0.95
applyMethod · 0.65
emptyMethod · 0.45

Tested by

no test coverage detected