MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / getOrConstruct

Method getOrConstruct

src/main/java/field/utility/Dict.java:448–456  ·  view source on GitHub ↗
(Prop<T> key)

Source from the content-addressed store, hash-verified

446 }
447
448 @SuppressWarnings("unchecked")
449 public <T> T getOrConstruct(Prop<T> key) {
450
451 Prop<T> cc = key.findCanon();
452 if (cc != null && cc.autoConstructor != null) {
453 return (T) dictionary.computeIfAbsent(key, k -> cc.autoConstructor.get());
454 }
455 return get(key);
456 }
457
458 public <T> T getOr(Prop<T> key, Supplier<T> def) {
459 T t = get(key);

Callers 15

targetMethod · 0.45
SubscopeMethod · 0.45
asMap_newMethod · 0.45
drawMethod · 0.45
defaultdrawsLinesMethod · 0.45
BoxesMethod · 0.45
defaultdrawsLinesMethod · 0.45
checkPairsMethod · 0.45
KeyboardShortcutsMethod · 0.45
VariantMethod · 0.45
updateToVariantMethod · 0.45
isExcludedMethod · 0.45

Calls 4

getMethod · 0.95
computeIfAbsentMethod · 0.80
getMethod · 0.65
findCanonMethod · 0.45

Tested by

no test coverage detected