public interface SampleList
Implementing classes must guarantee that the sample list will remain constant through the life of the object.
Modifier and Type | Field and Description |
---|---|
static SampleList |
EMPTY_LIST |
Modifier and Type | Method and Description |
---|---|
default java.util.List<java.lang.String> |
asListOfSamples()
Returns a
List unmodifiable view of a sample-list |
default java.util.Set<java.lang.String> |
asSetOfSamples()
Returns a
Set unmodifiable view of the sample-list |
static SampleList |
emptySampleList()
Empty list.
|
static boolean |
equals(SampleList first,
SampleList second)
Checks whether two sample lists are in fact the same.
|
java.lang.String |
getSample(int sampleIndex)
Returns the element given its index within the set.
|
int |
indexOfSample(java.lang.String sample)
Returns the index of an object.
|
int |
numberOfSamples()
Returns number of elements in the list.
|
static SampleList |
singletonSampleList(java.lang.String sampleName)
Creates a list with a single sample.
|
static final SampleList EMPTY_LIST
static SampleList emptySampleList()
null
int numberOfSamples()
int indexOfSample(java.lang.String sample)
sample
- the sample of interest.-1
if such a sample is not an element of this set, otherwise is index in the set thus a
values within [0,numberOfSamples()
).java.lang.IllegalArgumentException
- if sample
is null
.java.lang.String getSample(int sampleIndex)
sampleIndex
- the target samples's index.null
; as null is not a valid element.java.lang.IllegalArgumentException
- if index
is not valid; in [0,numberOfSamples()
).static boolean equals(SampleList first, SampleList second)
first
- one list to compare.second
- another list to compare.true
iff both list are equal.java.lang.IllegalArgumentException
- if if either list is null
.default java.util.List<java.lang.String> asListOfSamples()
List
unmodifiable view of a sample-listnull
.java.lang.IllegalArgumentException
- if list
is null
.default java.util.Set<java.lang.String> asSetOfSamples()
Set
unmodifiable view of the sample-liststatic SampleList singletonSampleList(java.lang.String sampleName)
sampleName
- the sample name.sampleName