Package com.bayesserver.data
Class DataColumnCollection
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<DataColumn>
-
- com.bayesserver.data.DataColumnCollection
-
- All Implemented Interfaces:
Iterable<DataColumn>
,Collection<DataColumn>
,List<DataColumn>
public final class DataColumnCollection extends AbstractList<DataColumn>
Represents a collection of columns in a DataTable, a simple in-memory data store.
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, DataColumn element)
Adds a DataColumn instance at the given index.DataColumn
add(String columnName, Class dataType)
Adds a new DataColumn to the collection.void
clear()
Removes all columns for the collection.DataColumn
get(int index)
Gets the DataColumn at the given index.DataColumn
get(String columnName)
Gets the column with the specified name, or null if the name if not found.int
indexOf(String columnName)
Gets the index of the column with the given name.DataColumn
remove(int index)
Removes the DataColumn at the given index.int
size()
Gets the number of columns in the collection.-
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, 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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
get
public DataColumn get(String columnName)
Gets the column with the specified name, or null if the name if not found.- Parameters:
columnName
- The name to find.- Returns:
- The DataColumn instance with the specified name or null if not found.
-
add
public DataColumn add(String columnName, Class dataType)
Adds a new DataColumn to the collection.- Parameters:
columnName
- The name of the new column.dataType
- The data type for the new column.- Returns:
- The new DataColumn instance.
-
indexOf
public int indexOf(String columnName)
Gets the index of the column with the given name.
-
get
public DataColumn get(int index)
Gets the DataColumn at the given index.- Specified by:
get
in interfaceList<DataColumn>
- Specified by:
get
in classAbstractList<DataColumn>
- Parameters:
index
- The zero based index for the column to retrieve.- Returns:
- The DataColumn at the specified index.
-
remove
public DataColumn remove(int index)
Removes the DataColumn at the given index.- Specified by:
remove
in interfaceList<DataColumn>
- Overrides:
remove
in classAbstractList<DataColumn>
- Parameters:
index
- The zero based index of the column to remove.- Returns:
- The DataColumn instance that was removed.
-
add
public void add(int index, DataColumn element)
Adds a DataColumn instance at the given index.- Specified by:
add
in interfaceList<DataColumn>
- Overrides:
add
in classAbstractList<DataColumn>
- Parameters:
index
- The zero based index.element
- The column to add.
-
clear
public void clear()
Removes all columns for the collection.- Specified by:
clear
in interfaceCollection<DataColumn>
- Specified by:
clear
in interfaceList<DataColumn>
- Overrides:
clear
in classAbstractList<DataColumn>
-
size
public int size()
Gets the number of columns in the collection.- Specified by:
size
in interfaceCollection<DataColumn>
- Specified by:
size
in interfaceList<DataColumn>
- Specified by:
size
in classAbstractCollection<DataColumn>
-
-