Or maybe the difference will become clearer when you create a method that processes cows, say one that collects the names of all cows, whales, dogs, horses, etc.
This method should not be aware of whales or any other subclass of cow. Nevertheless, it should work. Example:
public static List<String> collectNames(List<Cow> cows) { return cows.stream().map(c -> c.getName()).collect(Collectors.toList()); }
And I'm not sure why the whale is expanding the cow. If so, we should see him on the NG channel. A more correct example would be:
Animal β Cow, Dog, Cat, Whale
Person β Student, driver, developer, etc.
source share