Class FeatureNameList

Object
FeatureNameList
All Implemented Interfaces:
Iterable<String>

public class FeatureNameList extends Object implements Iterable<String>
A list of Strings representing feature names.
Author:
Owen Feehan
  • Constructor Details

    • FeatureNameList

      public FeatureNameList()
      Create with no names (an empty list).
    • FeatureNameList

      public FeatureNameList(Stream<String> stream)
      Create from a stream of names.
      Parameters:
      stream - the stream.
    • FeatureNameList

      public FeatureNameList(List<String> list)
  • Method Details

    • asList

      public List<String> asList()
      Exposes the underlying list of names.
      Returns:
      the underlying list, which if modified, will also modify this instance.
    • createMapToIndex

      public FeatureNameMapToIndex createMapToIndex()
      Creates a map from the feature-names to their indices in the list.
      Returns:
      a newly created map.
    • duplicateShallow

      public FeatureNameList duplicateShallow()
      Shallow copy of the current instance.
      Returns:
      a shallow copy.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • add

      public void add(String name)
      Adds a feature-name.
      Parameters:
      name - the name to add.
    • insertBeginning

      public void insertBeginning(String name)
      Inserts a new feature-name at the beginning of the list.
      Parameters:
      name - feature-name to insert.
    • insertBeginning

      public void insertBeginning(String[] names)
      Inserts new feature-names at the beginning of the list.
      Parameters:
      names - the feature-names to insert.
    • iterator

      public Iterator<String> iterator()
      Specified by:
      iterator in interface Iterable<String>
    • get

      public String get(int index)
      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.