MCPcopy
hub / github.com/google/guava / getOrDefault

Method getOrDefault

guava/src/com/google/common/collect/Maps.java:897–906  ·  view source on GitHub ↗
(@Nullable Object key, @Nullable V defaultValue)

Source from the content-addressed store, hash-verified

895 }
896
897 @Override
898 public @Nullable V getOrDefault(@Nullable Object key, @Nullable V defaultValue) {
899 if (Collections2.safeContains(backingSet(), key)) {
900 @SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it
901 K k = (K) key;
902 return function.apply(k);
903 } else {
904 return defaultValue;
905 }
906 }
907
908 @Override
909 public @Nullable V remove(@Nullable Object key) {

Callers 2

getMethod · 0.95
countMethod · 0.45

Calls 3

safeContainsMethod · 0.95
backingSetMethod · 0.95
applyMethod · 0.65

Tested by

no test coverage detected