D
Dimitri Maziuk
Richard C. Cobbe sez:
.... It appears that many
It depends: if this is used in the API, "HashMap" means "unsorted
map that may contain nulls and provides O(1) put()/get()" whereas
"TreeMap" means "sorted map, probably no null keys, O(log n) put()
and get()".
"Map" means "a map with none of the above guarantees".
-- that is, the programmers actually understand what they're doing
use it that way.
It is similar with hand-rolled interfaces: you declare one when
you have multiple not-too-specific implementations.
Dima
.... It appears that many
programmers are in the habit of using java.util.Map instead of, say,
java.util.HashMap.
It depends: if this is used in the API, "HashMap" means "unsorted
map that may contain nulls and provides O(1) put()/get()" whereas
"TreeMap" means "sorted map, probably no null keys, O(log n) put()
and get()".
"Map" means "a map with none of the above guarantees".
-- that is, the programmers actually understand what they're doing
use it that way.
It is similar with hand-rolled interfaces: you declare one when
you have multiple not-too-specific implementations.
Dima