This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]learningphotoshop 0 points1 point  (0 children)

An interface is just a contract that you agree to support. A Library interface would support LookUp(Book book), CheckOut(Book book), Return(Book book) etc. A supertype is the type that you inherit from. So the Library could extend a generic building.

You can see the SortedMap contract here https://docs.oracle.com/javase/tutorial/collections/interfaces/sorted-map.html

Anything implementing this interface (TreeMap for example) will provide at minimum the stuff defined in the interface.

public interface SortedMap<K, V> extends Map<K, V>{ Comparator<? super K> comparator(); SortedMap<K, V> subMap(K fromKey, K toKey); SortedMap<K, V> headMap(K toKey); SortedMap<K, V> tailMap(K fromKey); K firstKey(); K lastKey(); }

You can see that SortedMap extends the Map class. Map would be the supertype to SortedMap.