Ejemplo n.º 1
0
 /**
  * Adds the specified element to this set if it is not already present and the element >= 0.
  *
  * @param e element to be added to this set
  * @return <tt>true</tt> if this set did not already contain the specified element and the element
  *     >= 0
  */
 @Override
 public boolean add(Integer e) {
   if (e < 0) throw new RuntimeException("To add a negative number: " + e);
   if (contains(e)) {
     return false;
   }
   int wordIndex = wordIndex(e);
   expandTo(wordIndex);
   words[wordIndex] |= (1L << e);
   ++size;
   ++modCount;
   return true;
 }