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

public interface Vector<T> extends BaseVector<T,T,Stream<T>>
An immutable generic vector.
  • Method Details

    • get

      Vector<T> get(int... index)
      Description copied from interface: BaseVector
      Returns a new vector with selected entries.
      Specified by:
      get in interface BaseVector<T,T,Stream<T>>
      Parameters:
      index - the index of selected entries.
      Returns:
      the new vector of selected entries.
    • toArray

      T[] toArray()
      Returns the array of elements.
      Returns:
      the array of elements.
    • toDate

      Vector<LocalDate> 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

      Vector<LocalTime> 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

      default List<T> distinct()
      Returns the distinct values.
      Returns:
      the distinct values.
    • getBoolean

      default boolean getBoolean(int i)
      Description copied from interface: BaseVector
      Returns the boolean value at position i.
      Specified by:
      getBoolean in interface BaseVector<T,T,Stream<T>>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getChar

      default char getChar(int i)
      Description copied from interface: BaseVector
      Returns the character value at position i.
      Specified by:
      getChar in interface BaseVector<T,T,Stream<T>>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getByte

      default byte getByte(int i)
      Description copied from interface: BaseVector
      Returns the byte value at position i.
      Specified by:
      getByte in interface BaseVector<T,T,Stream<T>>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getShort

      default short getShort(int i)
      Description copied from interface: BaseVector
      Returns the short value at position i.
      Specified by:
      getShort in interface BaseVector<T,T,Stream<T>>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getInt

      default int getInt(int i)
      Description copied from interface: BaseVector
      Returns the integer value at position i.
      Specified by:
      getInt in interface BaseVector<T,T,Stream<T>>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getLong

      default long getLong(int i)
      Description copied from interface: BaseVector
      Returns the long value at position i.
      Specified by:
      getLong in interface BaseVector<T,T,Stream<T>>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getFloat

      default float getFloat(int i)
      Description copied from interface: BaseVector
      Returns the float value at position i.
      Specified by:
      getFloat in interface BaseVector<T,T,Stream<T>>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getDouble

      default double getDouble(int i)
      Description copied from interface: BaseVector
      Returns the double value at position i.
      Specified by:
      getDouble in interface BaseVector<T,T,Stream<T>>
      Parameters:
      i - the index.
      Returns:
      the value.
    • 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

      default String toString(int n)
      Returns the string representation of vector.
      Parameters:
      n - the number of elements to show.
      Returns:
      the string representation of vector.
    • of

      static <T> Vector<T> of(String name, Class<?> clazz, T[] vector)
      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

      static <T> Vector<T> of(String name, DataType type, T[] vector)
      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

      static <T> Vector<T> of(StructField field, T[] vector)
      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.