Package smile.data.vector
Interface Vector<T>
- Type Parameters:
T- the data type of vector elements.
- All Superinterfaces:
BaseVector<T,,T, Stream<T>> Serializable
- All Known Subinterfaces:
NumberVector,StringVector
An immutable generic vector.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleananyNull()Returns true if there are any NULL values in this row.distinct()Returns the distinct values.get(int... index) Returns a new vector with selected entries.default booleangetBoolean(int i) Returns the boolean value at position i.default bytegetByte(int i) Returns the byte value at position i.default chargetChar(int i) Returns the character value at position i.default doublegetDouble(int i) Returns the double value at position i.default floatgetFloat(int i) Returns the float value at position i.default intgetInt(int i) Returns the integer value at position i.default longgetLong(int i) Returns the long value at position i.default shortgetShort(int i) Returns the short value at position i.default booleanisNullAt(int i) Checks if the value at position i is null.static <T> Vector<T> Creates a named vector.static <T> Vector<T> Creates a named vector.static <T> Vector<T> of(StructField field, T[] vector) Creates a named vector.T[]toArray()Returns the array of elements.toDate()Returns a vector of LocalDate.Returns a vector of LocalDateTime.default StringtoString(int n) Returns the string representation of vector.toTime()Returns a vector of LocalTime.Methods inherited from interface smile.data.vector.BaseVector
apply, apply, array, field, get, measure, name, size, stream, toDoubleArray, toDoubleArray, toIntArray, toIntArray, toStringArray, toStringArray, type
-
Method Details
-
get
Description copied from interface:BaseVectorReturns a new vector with selected entries. -
toArray
T[] toArray()Returns the array of elements.- Returns:
- the array of elements.
-
toDate
Returns a vector of LocalDate. If the vector is of strings, it uses the default ISO date formatter that parses a date without an offset, such as '2011-12-03'. If the vector is of other time related objects such as Instant, java.util.Date, java.sql.Timestamp, etc., do a proper conversion.- Returns:
- the date vector.
-
toTime
Returns a vector of LocalTime. If the vector is of strings, it uses the default ISO time formatter that parses a time without an offset, such as '10:15' or '10:15:30'. If the vector is of other time related objects such as Instant, java.util.Date, java.sql.Timestamp, etc., do a proper conversion.- Returns:
- the time vector.
-
toDateTime
Vector<LocalDateTime> toDateTime()Returns a vector of LocalDateTime. If the vector is of strings, it uses the default ISO date time formatter that parses a date without an offset, such as '2011-12-03T10:15:30'. If the vector is of other time related objects such as Instant, java.util.Date, java.sql.Timestamp, etc., do a proper conversion.- Returns:
- the datetime vector.
-
distinct
Returns the distinct values.- Returns:
- the distinct values.
-
getBoolean
default boolean getBoolean(int i) Description copied from interface:BaseVectorReturns the boolean value at position i.- Specified by:
getBooleanin interfaceBaseVector<T,T, Stream<T>> - Parameters:
i- the index.- Returns:
- the value.
-
getChar
default char getChar(int i) Description copied from interface:BaseVectorReturns the character value at position i. -
getByte
default byte getByte(int i) Description copied from interface:BaseVectorReturns the byte value at position i. -
getShort
default short getShort(int i) Description copied from interface:BaseVectorReturns the short value at position i. -
getInt
default int getInt(int i) Description copied from interface:BaseVectorReturns the integer value at position i. -
getLong
default long getLong(int i) Description copied from interface:BaseVectorReturns the long value at position i. -
getFloat
default float getFloat(int i) Description copied from interface:BaseVectorReturns the float value at position i. -
getDouble
default double getDouble(int i) Description copied from interface:BaseVectorReturns the double value at position i. -
isNullAt
default boolean isNullAt(int i) Checks if the value at position i is null.- Parameters:
i- the index.- Returns:
- true if the value is null.
-
anyNull
default boolean anyNull()Returns true if there are any NULL values in this row.- Returns:
- true if there are any NULL values in this row.
-
toString
Returns the string representation of vector.- Parameters:
n- the number of elements to show.- Returns:
- the string representation of vector.
-
of
Creates a named vector.- Type Parameters:
T- the data type of vector elements.- Parameters:
name- the name of vector.clazz- the class of data type.vector- the data of vector.- Returns:
- the vector.
-
of
Creates a named vector.- Type Parameters:
T- the data type of vector elements.- Parameters:
name- the name of vector.type- the data type of vector.vector- the data of vector.- Returns:
- the vector.
-
of
Creates a named vector.- Type Parameters:
T- the data type of vector elements.- Parameters:
field- the struct field of vector.vector- the data of vector.- Returns:
- the vector.
-