public class IntSet extends Object
| Constructor and Description |
|---|
IntSet()
Constructs a new object that does not contain any number.
|
IntSet(String rangeSpecification)
Constructs a new object that contains the values from the given range
specification string.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(int value)
Gets whether the specified value is contained in this set of values.
|
boolean |
isEmpty()
Gets whether this IntSet is empty.
|
Iterator<Integer> |
iterator()
Gets an iterator over all values.
|
void |
setValues(String rangeSpecification)
Parses the given range specification string and sets the values in the
set accordingly.
|
String |
toSpecificationString()
Gets this object as a range specification string which can safely be
parsed by
setValues(String). |
String |
toString() |
public IntSet()
public IntSet(String rangeSpecification)
rangeSpecification - the range, expressed as a String. Allowed numbers can be
specified as
20,21,50,50-70,null for an empty rangeIllegalArgumentException - if the given range specification string is invalidtoSpecificationString()public void setValues(String rangeSpecification)
rangeSpecification - the range, expressed as a String. Allowed numbers can be
specified as
20,21,50,50-70,null for an empty rangeIllegalArgumentException - if the given range specification string is invalidtoSpecificationString()public boolean isEmpty()
true if this IntSet is empty, otherwise
falsesetValues(String),
iterator()public boolean contains(int value)
public String toSpecificationString()
setValues(String).null. The empty
string is returned when this set is empty.setValues(String)public Iterator<Integer> iterator()
setValues(String),
isEmpty()Copyright © 2016–2021. All rights reserved.