Set.java
public interface Set<E> extends Collection<E>{ int size(); boolean isEmpty(); boolean contains(Object o); Iterator<E> iterator(); Object[] toArray(); <T> T[] toArray(T[] a); boolean add(E e); boolean remove(Object o); boolean containsAll(Collection<?> c); boolean addAll(Collection<? extends E> c); boolean retainAll(Collection<?> c); boolean removeAll(Collection<?> c); void clear(); boolean equals(Object o); int hashCode(); }
A
Set is a collection, which can't contain duplicate elements. A Set
contains exactly the same methods that Collection provides, but adds
a restriction that duplicates are not allowed.
Two
Sets are said to be equal if they contain same elements.
A
Set extends the Collection interface, Where as HashSet, TreeSet and
LinkedHashSet implements the Set interface.
A
Set can contain a null element.
No comments:
Post a Comment