Sets value if key not set. Runs the function if the key is set to determine the new value. Removes if null.
Next, the exam expects you to know which data structures allow null values. The data structures that involve sorting do not allow null values.
TreeSet does not permit null elements. TreeMap does not permit null keys.
Stack Implements Queue. If you don't need concurrency, use a LinkedList instead.
Not my idea of a true stack; you need some other interface for that. Deque sounds good.Jesse Silverman wrote:. . . if the Stack contains some element we then pop()/poll(remove() our way down to it and do something . . . Using the Stack<> reference, I couldn't do the equivalent of .contains() on it . . .
Isn't it just.coding to Interface instead of Implementation is very powerful.
Don't understand; I can't see where var comes into it.Too bad, about var, then, no?
What are you doing in my house? Get 'em tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
|