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

Print this page




 272         }
 273 
 274         long oldElements = elements;
 275         elements &= es.elements;
 276         return elements != oldElements;
 277     }
 278 
 279     /**
 280      * Removes all of the elements from this set.
 281      */
 282     public void clear() {
 283         elements = 0;
 284     }
 285 
 286     /**
 287      * Compares the specified object with this set for equality.  Returns
 288      * <tt>true</tt> if the given object is also a set, the two sets have
 289      * the same size, and every member of the given set is contained in
 290      * this set.
 291      *
 292      * @param e object to be compared for equality with this set
 293      * @return <tt>true</tt> if the specified object is equal to this set
 294      */
 295     public boolean equals(Object o) {
 296         if (!(o instanceof RegularEnumSet))
 297             return super.equals(o);
 298 
 299         RegularEnumSet<?> es = (RegularEnumSet<?>)o;
 300         if (es.elementType != elementType)
 301             return elements == 0 && es.elements == 0;
 302         return es.elements == elements;
 303     }
 304 }


 272         }
 273 
 274         long oldElements = elements;
 275         elements &= es.elements;
 276         return elements != oldElements;
 277     }
 278 
 279     /**
 280      * Removes all of the elements from this set.
 281      */
 282     public void clear() {
 283         elements = 0;
 284     }
 285 
 286     /**
 287      * Compares the specified object with this set for equality.  Returns
 288      * <tt>true</tt> if the given object is also a set, the two sets have
 289      * the same size, and every member of the given set is contained in
 290      * this set.
 291      *
 292      * @param o object to be compared for equality with this set
 293      * @return <tt>true</tt> if the specified object is equal to this set
 294      */
 295     public boolean equals(Object o) {
 296         if (!(o instanceof RegularEnumSet))
 297             return super.equals(o);
 298 
 299         RegularEnumSet<?> es = (RegularEnumSet<?>)o;
 300         if (es.elementType != elementType)
 301             return elements == 0 && es.elements == 0;
 302         return es.elements == elements;
 303     }
 304 }