MCPcopy Create free account
hub / github.com/PCGen/pcgen / pop

Method pop

PCGen-base/code/src/java/pcgen/base/util/MappedDeque.java:79–87  ·  view source on GitHub ↗

Pops a value from the Deque for the given TypedKey. Note that this method will not block or throw an error if the Deque is empty. It will simply return the "Default Value" for the given TypeKey. Note null is a legal default value. @param key The TypeKey for which the given value should

(TypedKey<T> key)

Source from the content-addressed store, hash-verified

77 * @return The value popped from the Deque for the given TypeKey
78 */
79 public <T> T pop(TypedKey<T> key)
80 {
81 Deque<Object> dq = getDeque(Objects.requireNonNull(key));
82 if ((dq == null) || dq.isEmpty())
83 {
84 return key.getDefaultValue();
85 }
86 return key.cast(unwrap(dq.pop()));
87 }
88
89 /**
90 * Returns the top value of the Deque for the given TypedKey, without

Callers 15

testNonNullKeyMethod · 0.95
testPushPopPeekMethod · 0.95
testSetMethod · 0.95
testPopMethod · 0.95
emptySupplyingDequeMethod · 0.80
setMethod · 0.80
nextMethod · 0.80
testOr01Method · 0.80
testOr02Method · 0.80
testOr03Method · 0.80
testOr04Method · 0.80
testOr05Method · 0.80

Calls 5

getDequeMethod · 0.95
unwrapMethod · 0.95
isEmptyMethod · 0.65
getDefaultValueMethod · 0.65
castMethod · 0.45

Tested by 13

testNonNullKeyMethod · 0.76
testPushPopPeekMethod · 0.76
testSetMethod · 0.76
testPopMethod · 0.76
testOr01Method · 0.64
testOr02Method · 0.64
testOr03Method · 0.64
testOr04Method · 0.64
testOr05Method · 0.64
testIf01Method · 0.64
testIf02Method · 0.64
testIf03Method · 0.64