< prev index next >

src/java.base/share/classes/java/util/RegularEnumSet.java

Print this page

        

*** 121,143 **** public int size() { return Long.bitCount(elements); } /** ! * Returns <tt>true</tt> if this set contains no elements. * ! * @return <tt>true</tt> if this set contains no elements */ public boolean isEmpty() { return elements == 0; } /** ! * Returns <tt>true</tt> if this set contains the specified element. * * @param e element to be checked for containment in this collection ! * @return <tt>true</tt> if this set contains the specified element */ public boolean contains(Object e) { if (e == null) return false; Class<?> eClass = e.getClass(); --- 121,143 ---- public int size() { return Long.bitCount(elements); } /** ! * Returns {@code true} if this set contains no elements. * ! * @return {@code true} if this set contains no elements */ public boolean isEmpty() { return elements == 0; } /** ! * Returns {@code true} if this set contains the specified element. * * @param e element to be checked for containment in this collection ! * @return {@code true} if this set contains the specified element */ public boolean contains(Object e) { if (e == null) return false; Class<?> eClass = e.getClass();
*** 151,163 **** /** * Adds the specified element to this set if it is not already present. * * @param e element to be added to this set ! * @return <tt>true</tt> if the set changed as a result of the call * ! * @throws NullPointerException if <tt>e</tt> is null */ public boolean add(E e) { typeCheck(e); long oldElements = elements; --- 151,163 ---- /** * Adds the specified element to this set if it is not already present. * * @param e element to be added to this set ! * @return {@code true} if the set changed as a result of the call * ! * @throws NullPointerException if {@code e} is null */ public boolean add(E e) { typeCheck(e); long oldElements = elements;
*** 167,177 **** /** * Removes the specified element from this set if it is present. * * @param e element to be removed from this set, if present ! * @return <tt>true</tt> if the set contained the specified element */ public boolean remove(Object e) { if (e == null) return false; Class<?> eClass = e.getClass(); --- 167,177 ---- /** * Removes the specified element from this set if it is present. * * @param e element to be removed from this set, if present ! * @return {@code true} if the set contained the specified element */ public boolean remove(Object e) { if (e == null) return false; Class<?> eClass = e.getClass();
*** 184,198 **** } // Bulk Operations /** ! * Returns <tt>true</tt> if this set contains all of the elements * in the specified collection. * * @param c collection to be checked for containment in this set ! * @return <tt>true</tt> if this set contains all of the elements * in the specified collection * @throws NullPointerException if the specified collection is null */ public boolean containsAll(Collection<?> c) { if (!(c instanceof RegularEnumSet)) --- 184,198 ---- } // Bulk Operations /** ! * Returns {@code true} if this set contains all of the elements * in the specified collection. * * @param c collection to be checked for containment in this set ! * @return {@code true} if this set contains all of the elements * in the specified collection * @throws NullPointerException if the specified collection is null */ public boolean containsAll(Collection<?> c) { if (!(c instanceof RegularEnumSet))
*** 207,217 **** /** * Adds all of the elements in the specified collection to this set. * * @param c collection whose elements are to be added to this set ! * @return <tt>true</tt> if this set changed as a result of the call * @throws NullPointerException if the specified collection or any * of its elements are null */ public boolean addAll(Collection<? extends E> c) { if (!(c instanceof RegularEnumSet)) --- 207,217 ---- /** * Adds all of the elements in the specified collection to this set. * * @param c collection whose elements are to be added to this set ! * @return {@code true} if this set changed as a result of the call * @throws NullPointerException if the specified collection or any * of its elements are null */ public boolean addAll(Collection<? extends E> c) { if (!(c instanceof RegularEnumSet))
*** 234,244 **** /** * Removes from this set all of its elements that are contained in * the specified collection. * * @param c elements to be removed from this set ! * @return <tt>true</tt> if this set changed as a result of the call * @throws NullPointerException if the specified collection is null */ public boolean removeAll(Collection<?> c) { if (!(c instanceof RegularEnumSet)) return super.removeAll(c); --- 234,244 ---- /** * Removes from this set all of its elements that are contained in * the specified collection. * * @param c elements to be removed from this set ! * @return {@code true} if this set changed as a result of the call * @throws NullPointerException if the specified collection is null */ public boolean removeAll(Collection<?> c) { if (!(c instanceof RegularEnumSet)) return super.removeAll(c);
*** 255,265 **** /** * Retains only the elements in this set that are contained in the * specified collection. * * @param c elements to be retained in this set ! * @return <tt>true</tt> if this set changed as a result of the call * @throws NullPointerException if the specified collection is null */ public boolean retainAll(Collection<?> c) { if (!(c instanceof RegularEnumSet)) return super.retainAll(c); --- 255,265 ---- /** * Retains only the elements in this set that are contained in the * specified collection. * * @param c elements to be retained in this set ! * @return {@code true} if this set changed as a result of the call * @throws NullPointerException if the specified collection is null */ public boolean retainAll(Collection<?> c) { if (!(c instanceof RegularEnumSet)) return super.retainAll(c);
*** 283,298 **** elements = 0; } /** * Compares the specified object with this set for equality. Returns ! * <tt>true</tt> if the given object is also a set, the two sets have * the same size, and every member of the given set is contained in * this set. * * @param o object to be compared for equality with this set ! * @return <tt>true</tt> if the specified object is equal to this set */ public boolean equals(Object o) { if (!(o instanceof RegularEnumSet)) return super.equals(o); --- 283,298 ---- elements = 0; } /** * Compares the specified object with this set for equality. Returns ! * {@code true} if the given object is also a set, the two sets have * the same size, and every member of the given set is contained in * this set. * * @param o object to be compared for equality with this set ! * @return {@code true} if the specified object is equal to this set */ public boolean equals(Object o) { if (!(o instanceof RegularEnumSet)) return super.equals(o);
< prev index next >