Beispiel #1
0
 @Override
 public boolean equals(Object o) {
   if (o.getClass() != getClass()) {
     return false;
   }
   BitSet other = (BitSet) o;
   if (size() != other.size() || this.wordsInUse != other.wordsInUse) {
     return false;
   }
   return Arrays.equals(words, other.words);
 }
Beispiel #2
0
 /**
  * Returns a new bit set containing all the integer in the given arguments.
  *
  * @param ints the given ints will be contained in the new BitSet
  * @return a {@code BitSet} containing all the integer in the {@code ints}
  */
 public static BitSet valueOf(Integer... ints) {
   int max = -1;
   for (int i : ints) {
     if (i < 0) {
       throw new RuntimeException("The element < 0:" + i);
     }
     max = i > max ? i : max;
   }
   BitSet bitset = new BitSet(max);
   for (int i : ints) {
     bitset.add(i);
   }
   return bitset;
 }