public class IndexSequence extends Object implements Set<String>
IndexSequence
is a lightweight ordered sequence of string representing array indexes. It is lightweight because it
shares and reuses the strings for indexes less than the maximum key count
.Modifier and Type | Field and Description |
---|---|
protected static String[] |
EMPTY_ARRAY |
protected static String[] |
INDEX_VALUES |
protected static int |
MAXIMUM_KEY_COUNT |
protected int |
size |
Constructor and Description |
---|
IndexSequence(int size) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(String e) |
boolean |
addAll(Collection<? extends String> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
static Iterator<String> |
indexesTo(int size)
Obtain an iterator for the indexes up to the specified size.
|
static Iterator<String> |
infiniteSequence()
Obtain an iterator for the indexes up the
largest integer. |
boolean |
isEmpty() |
Iterator<String> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode, spliterator
parallelStream, removeIf, stream
protected static final String[] EMPTY_ARRAY
protected static final String[] INDEX_VALUES
protected static final int MAXIMUM_KEY_COUNT
protected final int size
public static Iterator<String> indexesTo(int size)
size
- the number of indexespublic static Iterator<String> infiniteSequence()
largest
integer. This is efficient, because it only
builds strings as needed.public boolean add(String e)
public boolean addAll(Collection<? extends String> c)
public void clear()
public boolean contains(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<String>
containsAll
in interface Set<String>
public boolean isEmpty()
public boolean remove(Object o)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public int size()
public Object[] toArray()
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.