Ejemplo n.º 1
0
 public static PrimitiveIntSet asSetAllowDuplicates(PrimitiveIntIterator iterator) {
   PrimitiveIntSet set = Primitive.intSet();
   while (iterator.hasNext()) {
     set.add(iterator.next());
   }
   return set;
 }
Ejemplo n.º 2
0
 public static PrimitiveIntSet asSet(int[] values) {
   PrimitiveIntSet set = Primitive.intSet(values.length);
   for (int value : values) {
     set.add(value);
   }
   return set;
 }
Ejemplo n.º 3
0
 public static PrimitiveIntSet asSet(PrimitiveIntIterator iterator) {
   PrimitiveIntSet set = Primitive.intSet();
   while (iterator.hasNext()) {
     int next = iterator.next();
     if (!set.add(next)) {
       throw new IllegalStateException("Duplicate " + next + " from " + iterator);
     }
   }
   return set;
 }