ch.javasoft.util.intcoll
Class RangeIntSet
java.lang.Object
ch.javasoft.util.intcoll.AbstractIntCollection
ch.javasoft.util.intcoll.AbstractSortedIntSet
ch.javasoft.util.intcoll.RangeIntSet
- All Implemented Interfaces:
- IntCollection, IntIterable, IntSet, SortedIntSet, Serializable, Iterable<Integer>, Collection<Integer>, Set<Integer>, SortedSet<Integer>
public class RangeIntSet
- extends AbstractSortedIntSet
- implements Serializable
Implementation of IntSet, also implementing SortedSet, for an integer range.
All values in this range are members of this set, the set is unmodifiable.
- See Also:
- Serialized Form
|
Constructor Summary |
RangeIntSet(int start,
int end)
Constructor for RangeIntSet start index (inclusive) and
end index (exclusive). |
| Methods inherited from class ch.javasoft.util.intcoll.AbstractIntCollection |
add, addAll, addAll, addAll, clone, contains, containsAll, first, last, remove, removeAll, retainAll, toArray, toArray, toIntArray, toIntArray |
RangeIntSet
public RangeIntSet(int start,
int end)
- Constructor for
RangeIntSet start index (inclusive) and
end index (exclusive).
- Parameters:
start - the first index in the range (inclusive)end - the first index out of the range (exclusive)
size
public int size()
- Specified by:
size in interface Collection<Integer>- Specified by:
size in interface Set<Integer>- Specified by:
size in class AbstractIntCollection
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Collection<Integer>- Specified by:
isEmpty in interface Set<Integer>- Overrides:
isEmpty in class AbstractIntCollection
containsInt
public boolean containsInt(int o)
- Specified by:
containsInt in interface IntCollection- Overrides:
containsInt in class AbstractIntCollection
iterator
public Iterator<Integer> iterator()
- Specified by:
iterator in interface Iterable<Integer>- Specified by:
iterator in interface Collection<Integer>- Specified by:
iterator in interface Set<Integer>- Overrides:
iterator in class AbstractIntCollection
toArrayInternal
protected <T> T[] toArrayInternal(T[] arr,
boolean checkSize)
- Overrides:
toArrayInternal in class AbstractIntCollection
clear
public void clear()
- Specified by:
clear in interface Collection<Integer>- Specified by:
clear in interface Set<Integer>- Specified by:
clear in class AbstractIntCollection
addInt
public boolean addInt(int value)
- Specified by:
addInt in interface IntCollection- Specified by:
addInt in class AbstractIntCollection
removeInt
public boolean removeInt(int value)
- Specified by:
removeInt in interface IntCollection- Specified by:
removeInt in class AbstractIntCollection
intIterator
public IntIterator intIterator()
- Specified by:
intIterator in interface IntCollection- Specified by:
intIterator in interface IntIterable- Specified by:
intIterator in class AbstractIntCollection
toIntArrayInternal
protected int[] toIntArrayInternal(int[] arr,
boolean checkSize)
- Overrides:
toIntArrayInternal in class AbstractIntCollection
comparator
public Comparator<? super Integer> comparator()
- Specified by:
comparator in interface SortedSet<Integer>
- Returns:
- always null
firstInt
public int firstInt()
- Overrides:
firstInt in class AbstractIntCollection
lastInt
public int lastInt()
- Overrides:
lastInt in class AbstractIntCollection
subSet
public RangeIntSet subSet(int from,
int to)
- Description copied from interface:
SortedIntSet
- Returns a view of the portion of this set whose elements range
from fromElement, inclusive, to toElement,
exclusive. (If fromElement and toElement are
equal, the returned set is empty.) The returned set is backed
by this set, so changes in the returned set are reflected in
this set, and vice-versa. The returned set supports all
optional set operations that this set supports.
The returned set will throw an IllegalArgumentException
on an attempt to insert an element outside its range.
- Specified by:
subSet in interface SortedIntSet
- Parameters:
from - low endpoint (inclusive) of the returned setto - high endpoint (exclusive) of the returned set
- Returns:
- a view of the portion of this set whose elements range from
fromElement, inclusive, to toElement, exclusive
equals
public boolean equals(Object obj)
- Specified by:
equals in interface Collection<Integer>- Specified by:
equals in interface Set<Integer>- Overrides:
equals in class AbstractSortedIntSet
hashCode
public int hashCode()
- Specified by:
hashCode in interface Collection<Integer>- Specified by:
hashCode in interface Set<Integer>- Overrides:
hashCode in class AbstractIntCollection
toString
public String toString()
- Overrides:
toString in class AbstractIntCollection