Did your instructor give you javadocs for their HashMap class which explains the novel behaviour? You can't even try out java.util.HashMap, LinkedHashMap or TreeMap because your instructor's HashMap...
Type: Posts; User: Sean4u
Did your instructor give you javadocs for their HashMap class which explains the novel behaviour? You can't even try out java.util.HashMap, LinkedHashMap or TreeMap because your instructor's HashMap...
Waidaminnit! Since when did HashMap have an iterator() method?
:facepalm:
You should use LinkedHashMap or TreeMap if you care about the order of your iterators. I'm agog at the order *changing* though - I'd be interested to see an SSCCE that demonstrated that behaviour. I...
Uh? HashMap isn't in any way sorted, so the out-of-order is to be expected. Changing order is as weird as in-order. TreeMap would give you sorting, LinkedHashMap reliable ordering. Do you remove /...
D'oh! duplicate post...
That's your solution's natural ground, where it's behaving not only as a success flag but also as a communications channel. If the task in hand is 'can a matching item be found?', then a Boolean /...
Returning something from a successful search method invocation seems like a good way of terminating your search. Can you continue / break your loop depending on the return value of the search method?...