2

Generally we use Set interface for implementation of any kind of set. Under what situations will we have to use the AbstractSet class and not the Set interface.I looked in the source and found that the AbstractSet contains implementations of the equals,hashcode and the removeAll method.

Saumya Tiwari
  • 23
  • 1
  • 7
  • 2
    Possible duplicate of [Interface vs Abstract Class (general OO)](http://stackoverflow.com/questions/761194/interface-vs-abstract-class-general-oo) – Felix Gerber Dec 07 '15 at 14:01

1 Answers1

0

You shall never use in your implementation the AbstractSet class. Only if you want to implement your own class of a set, then you can derive your class from AbstractSet. In all other cases use Set or the Subinterfaces from Set.

chokdee
  • 419
  • 4
  • 13