Set Interface - Walking Techie

Blog about Java programming, Design Pattern, and Data Structure.

Saturday, November 26, 2016

Set Interface

The Set interface defines a set. It extends Collection and specifies the behavior of a collection that does not allow duplicate elements.

Therefore, the add( ) method returns false if an attempt is made to add duplicate elements to a set.

It does not have any additional methods of its own.

Set is a generic interface that has this declaration:

public interface Set<E> extends Collection<E>

Here, E specifies the type of objects that the set will hold. Set has methods only that is declared in Collection interface.

sub-type of set interface in java that extends Set interface.

No comments :

Post a Comment