Package org.anchoranalysis.feature.name
Class FeatureNameList
Object
FeatureNameList
A list of
String
s representing feature names.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionCreate with no names (an empty list).FeatureNameList
(List<String> list) FeatureNameList
(Stream<String> stream) Create from a stream of names. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a feature-name.asList()
Exposes the underlying list of names.Creates a map from the feature-names to their indices in the list.Shallow copy of the current instance.get
(int index) Gets a name corresponding to a particular position.void
insertBeginning
(String name) Inserts a new feature-name at the beginning of the list.void
insertBeginning
(String[] names) Inserts new feature-names at the beginning of the list.iterator()
int
size()
The number of names in the list.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
FeatureNameList
public FeatureNameList()Create with no names (an empty list). -
FeatureNameList
Create from a stream of names.- Parameters:
stream
- the stream.
-
FeatureNameList
-
-
Method Details
-
asList
Exposes the underlying list of names.- Returns:
- the underlying list, which if modified, will also modify this instance.
-
createMapToIndex
Creates a map from the feature-names to their indices in the list.- Returns:
- a newly created map.
-
duplicateShallow
Shallow copy of the current instance.- Returns:
- a shallow copy.
-
toString
-
add
Adds a feature-name.- Parameters:
name
- the name to add.
-
insertBeginning
Inserts a new feature-name at the beginning of the list.- Parameters:
name
- feature-name to insert.
-
insertBeginning
Inserts new feature-names at the beginning of the list.- Parameters:
names
- the feature-names to insert.
-
iterator
-
get
Gets a name corresponding to a particular position.- Parameters:
index
- the position of the name in the list (zero-indexed).- Returns:
- the corresponding name.
-
size
public int size()The number of names in the list.- Returns:
- the total number of names.
-