In the real world what do people use this for (to solve what types of problems)? Can I see some example code of these working together? All I can find is code about cats and
Map peopleByName = new HashMap();
If, down the road, I decide the memory overhead of HashMap is too much, I can re-do this as a TreeMap, and live with the slightly more expensive lookup times
Map peopleByName = new TreeMap();
Because peopleByName is a Map, not a TreeMap or a HashMap, all my calls are guaranteed to work on either map regardless of implementation.
This is best illustrated with the following example
public class CatsAndDogsDrinkingMilkAndCoffee {
// what, no? :-(
}