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)
| 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 |