Reputation: 1050
I know Collection is an interface containing abstract methods such as add(), addAll(),..
and Collections is a class containing static methods such as addAll(),max(),.. which extends Object.
and
Collection implements interface Iterable.
Interface since it can contain only abstract methods would contain only abstract method(which won't have definition).
So, my question is if List,Set,.. are implementing Collection interface then where will be the definitions of methods like add(), addAll(), remove(), contains(), iterator(),.. written?
Upvotes: 0
Views: 65
Reputation: 393801
List
and Set
don't implement Collection
, since they are also interfaces (which extend the Collection
interface).
The implementations are in the implementing classes, such as ArrayList
, LinkedList
, HashSet
, etc...
Upvotes: 5