2

What do the terms "underlying object" and "underlying implementation" mean?

(English is not my native language).

Anthon
  • 69,918
  • 32
  • 186
  • 246
  • 1
    where have you read this? In which context are you talking about these terms? – SMA Mar 21 '15 at 05:57
  • @SMA http://stackoverflow.com/questions/1348199/java-hashmap-vs-map-objects – Aleksey Galanov Mar 21 '15 at 06:01
  • Thanks, other distractions and chit-chat (read [help→tour](http://stackoverflow.com/tour)) are never part of a good question. It is not impolite to leave that out but it is wasting readers time when you put it in. – Anthon Mar 21 '15 at 06:18
  • 1
    It really just means "the object" or "the implementation" in this case. Forget the word "underlying". – user253751 Mar 21 '15 at 06:23
  • @immibis consider an instance of `LinkedHashMap` which is casted to a `HashMap`. Both `LinkedHashMap` and `HashMap` are classes and both have implementations. I would say that in this case `LinkedHashMap` could be referred to as `underlying implementation`. – S. Pauk Mar 21 '15 at 06:30

2 Answers2

1

By Underlying Object, we meant that the object that you are going to put into the map are going to be the same.

By Underlying implementation means, by using Map interface, you could inject HashMap or TreeMap or any other Map as long as it implements Map using Runtime polymorphism and making your code loosely coupled and designing by contract rather than by implementation.

SMA
  • 36,381
  • 8
  • 49
  • 73
1

Regarding the link you have mentioned: in the first case HashMap is casted to a HashMap while in the second case HashMap is casted to a Map. Though you will have two different access interfaces to those objects their underlying object (i.e. what they really are) is the same HashMap.

S. Pauk
  • 5,208
  • 4
  • 31
  • 41