@@ -139,14 +139,30 @@ static Collector<Integer, ArrayList<Integer>, BitSet<Integer>> collector() {
139
139
return Builder .DEFAULT .collector ();
140
140
}
141
141
142
+ /**
143
+ * Returns a BitSet containing no elements.
144
+ *
145
+ * @return an empty BitSet
146
+ */
142
147
static BitSet <Integer > empty () {
143
148
return Builder .DEFAULT .empty ();
144
149
}
145
150
151
+ /**
152
+ * Returns a BitSet containing a single value.
153
+ *
154
+ * @param value A single value
155
+ * @return A BitSet containing the given value
156
+ */
146
157
static BitSet <Integer > of (Integer value ) {
147
158
return Builder .DEFAULT .of (value );
148
159
}
149
160
161
+ /**
162
+ * Creates a BitSet of int numbers starting from {@code from}, extending to {@code toExclusive - 1}.
163
+ * @param values int values
164
+ * @return A new BitSet of int values
165
+ */
150
166
static BitSet <Integer > of (Integer ... values ) {
151
167
return Builder .DEFAULT .of (values );
152
168
}
@@ -176,10 +192,20 @@ static BitSet<Integer> fill(int n, Supplier<Integer> s) {
176
192
return Builder .DEFAULT .fill (n , s );
177
193
}
178
194
195
+ /**
196
+ * Creates a BitSet of int numbers starting from {@code from}, extending to {@code toExclusive - 1}.
197
+ * @param values int values
198
+ * @return A new BitSet of int values
199
+ */
179
200
static BitSet <Integer > ofAll (Iterable <Integer > values ) {
180
201
return Builder .DEFAULT .ofAll (values );
181
202
}
182
203
204
+ /**
205
+ * Creates a BitSet of int numbers starting from {@code from}, extending to {@code toExclusive - 1}.
206
+ * @param javaStream A java.util.stream.Stream of int values
207
+ * @return A new BitSet of int values
208
+ */
183
209
static BitSet <Integer > ofAll (java .util .stream .Stream <Integer > javaStream ) {
184
210
return Builder .DEFAULT .ofAll (javaStream );
185
211
}
@@ -267,10 +293,24 @@ static BitSet<Integer> range(int from, int toExclusive) {
267
293
return BitSet .ofAll (Iterator .range (from , toExclusive ));
268
294
}
269
295
296
+ /**
297
+ * Creates a BitSet of char numbers starting from {@code from}, extending to {@code toExclusive - 1}.
298
+ *
299
+ * @param from the first number
300
+ * @param toExclusive the last number + 1
301
+ * @return a range of char values as specified or the empty range if {@code from >= toExclusive}
302
+ */
270
303
static BitSet <Character > range (char from , char toExclusive ) {
271
304
return BitSet .withCharacters ().ofAll (Iterator .range (from , toExclusive ));
272
305
}
273
306
307
+ /**
308
+ * Creates a BitSet of long numbers starting from {@code from}, extending to {@code toExclusive - 1}.
309
+ *
310
+ * @param from the first number
311
+ * @param toExclusive the last number + 1
312
+ * @return a range of long values as specified or the empty range if {@code from >= toExclusive}
313
+ */
274
314
static BitSet <Long > range (long from , long toExclusive ) {
275
315
return BitSet .withLongs ().ofAll (Iterator .range (from , toExclusive ));
276
316
}
@@ -291,10 +331,32 @@ static BitSet<Integer> rangeBy(int from, int toExclusive, int step) {
291
331
return BitSet .ofAll (Iterator .rangeBy (from , toExclusive , step ));
292
332
}
293
333
334
+ /** Creates a BitSet of char numbers starting from {@code from}, extending to {@code toExclusive - 1},
335
+ * with {@code step}.
336
+ *
337
+ * @param from the first number
338
+ * @param toExclusive the last number + 1
339
+ * @param step the step
340
+ * @return a range of char values as specified or the empty range if<br>
341
+ * {@code from >= toInclusive} and {@code step > 0} or<br>
342
+ * {@code from <= toInclusive} and {@code step < 0}
343
+ * @throws IllegalArgumentException if {@code step} is zero
344
+ */
294
345
static BitSet <Character > rangeBy (char from , char toExclusive , int step ) {
295
346
return BitSet .withCharacters ().ofAll (Iterator .rangeBy (from , toExclusive , step ));
296
347
}
297
348
349
+ /** Creates a BitSet of long numbers starting from {@code from}, extending to {@code toExclusive - 1},
350
+ * with {@code step}.
351
+ *
352
+ * @param from the first number
353
+ * @param toExclusive the last number + 1
354
+ * @param step the step
355
+ * @return a range of long values as specified or the empty range if<br>
356
+ * {@code from >= toInclusive} and {@code step > 0} or<br>
357
+ * {@code from <= toInclusive} and {@code step < 0}
358
+ * @throws IllegalArgumentException if {@code step} is zero
359
+ */
298
360
static BitSet <Long > rangeBy (long from , long toExclusive , long step ) {
299
361
return BitSet .withLongs ().ofAll (Iterator .rangeBy (from , toExclusive , step ));
300
362
}
@@ -310,10 +372,24 @@ static BitSet<Integer> rangeClosed(int from, int toInclusive) {
310
372
return BitSet .ofAll (Iterator .rangeClosed (from , toInclusive ));
311
373
}
312
374
375
+ /**
376
+ * Creates a BitSet of char numbers starting from {@code from}, extending to {@code toInclusive}.
377
+ *
378
+ * @param from the first number
379
+ * @param toInclusive the last number
380
+ * @return a range of char values as specified or the empty range if {@code from > toInclusive}
381
+ */
313
382
static BitSet <Character > rangeClosed (char from , char toInclusive ) {
314
383
return BitSet .withCharacters ().ofAll (Iterator .rangeClosed (from , toInclusive ));
315
384
}
316
385
386
+ /**
387
+ * Creates a BitSet of long numbers starting from {@code from}, extending to {@code toInclusive}.
388
+ *
389
+ * @param from the first number
390
+ * @param toInclusive the last number
391
+ * @return a range of long values as specified or the empty range if {@code from > toInclusive}
392
+ */
317
393
static BitSet <Long > rangeClosed (long from , long toInclusive ) {
318
394
return BitSet .withLongs ().ofAll (Iterator .rangeClosed (from , toInclusive ));
319
395
}
@@ -334,10 +410,34 @@ static BitSet<Integer> rangeClosedBy(int from, int toInclusive, int step) {
334
410
return BitSet .ofAll (Iterator .rangeClosedBy (from , toInclusive , step ));
335
411
}
336
412
413
+ /**
414
+ * Creates a BitSet of char numbers starting from {@code from}, extending to {@code toInclusive},
415
+ * with {@code step}.
416
+ *
417
+ * @param from the first number
418
+ * @param toInclusive the last number
419
+ * @param step the step
420
+ * @return a range of char values as specified or the empty range if<br>
421
+ * {@code from > toInclusive} and {@code step > 0} or<br>
422
+ * {@code from < toInclusive} and {@code step < 0}
423
+ * @throws IllegalArgumentException if {@code step} is zero
424
+ */
337
425
static BitSet <Character > rangeClosedBy (char from , char toInclusive , int step ) {
338
426
return BitSet .withCharacters ().ofAll (Iterator .rangeClosedBy (from , toInclusive , step ));
339
427
}
340
428
429
+ /**
430
+ * Creates a BitSet of long numbers starting from {@code from}, extending to {@code toInclusive},
431
+ * with {@code step}.
432
+ *
433
+ * @param from the first number
434
+ * @param toInclusive the last number
435
+ * @param step the step
436
+ * @return a range of long values as specified or the empty range if<br>
437
+ * {@code from > toInclusive} and {@code step > 0} or<br>
438
+ * {@code from < toInclusive} and {@code step < 0}
439
+ * @throws IllegalArgumentException if {@code step} is zero
440
+ */
341
441
static BitSet <Long > rangeClosedBy (long from , long toInclusive , long step ) {
342
442
return BitSet .withLongs ().ofAll (Iterator .rangeClosedBy (from , toInclusive , step ));
343
443
}
0 commit comments