Java Java Data Structures Exploring the Java Collection Framework Sets

Adarsh Cavale
Adarsh Cavale
2,262 Points

You said Set is an interface. How come you don't have to implement the interface?

Wouldnt you have to put something in the Example class like "implements ..." like how we did in the Treet class for "implements Comparable, Serializable" ?

1 Answer

We are using another class that implements the Set interface; in the source code of this one, we would find the implements Set line. If we wanted to create our own Set implementation, we would indeed need to implement the interface.