|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<T>
rita.support.FinalSet<T>
public class FinalSet<T extends java.lang.Comparable>
This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). This class provides a very simple container implementation with zero overhead. A FinalSet bases on a sorted, unmodifiable array. The constructor can either be called with a sorted unmodifiable array (default constructor) or with an array that can be cloned and sorted beforehand if desired. Example:
FinalSetf=new FinalSet("a","b","c"); // equivalently: // FinalSet f=new FinalSet(new String[]{"a","b","c"}); // FinalSet f=new FinalSet(SHALLNOTBECLONED,ISSORTED,"a","b","c"); System.out.println(f.get(1)); --> b
| Field Summary | |
|---|---|
T[] |
data
Holds the data, must be sorted |
| Constructor Summary | |
|---|---|
FinalSet(boolean clone,
T... a)
Constructs a FinalSet from an array, clones and sorts the array if indicated. |
|
FinalSet(T... a)
Constructs a FinalSet from an array that does not need to be cloned |
|
| Method Summary | |
|---|---|
boolean |
contains(T x)
Tells whether x is in the container |
T |
get(int i)
Returns the element at position i |
int |
indexOf(T x)
Returns the position in the array or -1 |
int |
size()
Returns the number of elements in this FinalSet |
| Methods inherited from class java.util.AbstractList |
|---|
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, set, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from interface java.util.List |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
public T extends java.lang.Comparable[] data
| Constructor Detail |
|---|
public FinalSet(boolean clone,
T... a)
public FinalSet(T... a)
| Method Detail |
|---|
public boolean contains(T x)
public int indexOf(T x)
public T get(int i)
get in interface java.util.List<T extends java.lang.Comparable>get in class java.util.AbstractList<T extends java.lang.Comparable>public int size()
size in interface java.util.Collection<T extends java.lang.Comparable>size in interface java.util.List<T extends java.lang.Comparable>size in interface java.util.Set<T extends java.lang.Comparable>size in class java.util.AbstractCollection<T extends java.lang.Comparable>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||