All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.landawn.abacus.DataSet Maven / Gradle / Ivy

/*
 * Copyright (c) 2015, Haiyang Li.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.landawn.abacus;

import java.io.File;
import java.io.OutputStream;
import java.io.Writer;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

import com.landawn.abacus.util.ImmutableIterator;
import com.landawn.abacus.util.ListMultimap;
import com.landawn.abacus.util.Multimap;
import com.landawn.abacus.util.Multiset;
import com.landawn.abacus.util.Nullable;
import com.landawn.abacus.util.Optional;
import com.landawn.abacus.util.OptionalDouble;
import com.landawn.abacus.util.Properties;
import com.landawn.abacus.util.Sheet;
import com.landawn.abacus.util.Try;
import com.landawn.abacus.util.function.IntFunction;
import com.landawn.abacus.util.stream.Collector;
import com.landawn.abacus.util.stream.Stream;

/**
 * Uses IntFunction rowSupplier to identity row for generic types.
 *
 * @since 0.8
 * 
 * @author Haiyang Li
 */
public interface DataSet {

    //    /**
    //     * Returns the entity name associated with the query.
    //     *
    //     * @return
    //     */
    //    String entityName();
    //
    //    /**
    //     * Returns the target entity class associated with the query.
    //     *
    //     * @return
    //     */
    //     Class entityClass();

    /**
     * Return the column name list in this DataSet.
     */
    List columnNameList();

    /**
     * Return the column name list filtered by specified filter.
     * 
     * @param filter
     */
     List columnNames(Try.Predicate filter) throws E;

    /**
     * Method getColumnName.
     *
     * @param columnIndex
     * @return
     */
    String getColumnName(int columnIndex);

    /**
     * Method getColumnIndex.
     *
     * @param columnName
     * @return -1 if the specified columnName is not found
     */
    int getColumnIndex(String columnName);

    /**
     * -1 is set to the element in the returned array if the mapping column name is not included in this DataSet
     *
     * @param columnNames
     * @return
     */
    int[] getColumnIndex(Collection columnNames);

    /**
     *
     * @param columnName
     * @return
     */
    boolean containsColumn(String columnName);

    /**
     * Check if this DataSet contains all the specified columns.
     *
     * @param columnNames
     * @return true if all the specified columns are included in the this DataSet
     */
    boolean containsColumnAll(Collection columnNames);

    /**
     *
     * @param columnName
     * @param newColumnName
     */
    void renameColumn(String columnName, String newColumnName);

    /**
     * 
     * @param oldNewNames
     */
    void renameColumn(Map oldNewNames);

    /**
     *
     * @param columnName
     * @param func
     */
     void renameColumn(String columnName, Try.Function func) throws E;

    /**
     *
     * @param columnNames
     * @param func
     */
     void renameColumn(Collection columnNames, Try.Function func) throws E;

    void moveColumn(String columnName, int newPosition);

    void moveColumn(Map columnNameNewPositionMap);

    /**
     * Swap the positions of the two specified columns.
     * 
     * @param columnNameA
     * @param columnNameB
     */
    void swapColumn(String columnNameA, String columnNameB);

    /**
     * Move the specified row to the new position.
     * 
     * @param rowIndex
     * @param newRowIndex
     */
    void moveRow(int rowIndex, int newRowIndex);

    /**
     * Swap the positions of the two specified rows.
     * 
     * @param columnNameA
     * @param columnNameB
     */
    void swapRow(int rowIndexA, int rowIndexB);

    /**
     *
     * @param rowIndex
     * @param columnIndex
     * @return
     */
     T get(int rowIndex, int columnIndex);

    /**
     * @param targetClass
     * @param rowIndex
     * @param columnIndex
     * @return
     */
     T get(Class targetClass, int rowIndex, int columnIndex);

    /**
     *
     * @param rowIndex
     * @param columnIndex
     * @param element
     */
    void set(int rowIndex, int columnIndex, Object element);

    /**
     * 
     * @param rowIndex
     * @param columnIndex
     * @return
     */
    boolean isNull(int rowIndex, int columnIndex);

    /**
     *
     * @param columnIndex
     * @return
     */
     T get(int columnIndex);

    /**
     *
     * @param targetClass
     * @param columnIndex
     * @return
     */
     T get(Class targetClass, int columnIndex);

    /**
     *
     * @param columnName
     * @return
     */
     T get(String columnName);

    /**
     *
     * @param targetClass
     * @param columnName
     * @return
     */
     T get(Class targetClass, String columnName);

    /**
     * Return default value (false) if the property is null.
     *
     * @param columnIndex
     * @return
     */
    boolean getBoolean(int columnIndex);

    /**
     * Return default value (false) if the property is null.
     *
     * @param columnName
     * @return
     */
    boolean getBoolean(String columnName);

    /**
     * Return default value (0) if the property is null.
     *
     * @param columnIndex
     * @return
     */
    char getChar(int columnIndex);

    /**
     * Return default value (0) if the property is null.
     *
     * @param columnName
     * @return
     */
    char getChar(String columnName);

    /**
     * Return default value (0) if the property is null. Return Number.byteValue() otherwise.
     *
     * @param columnIndex
     * @return
     */
    byte getByte(int columnIndex);

    /**
     * Return default value (0) if the property is null. Return Number.byteValue() otherwise.
     *
     * @param columnName
     * @return
     */
    byte getByte(String columnName);

    /**
     * Return default value (0) if the property is null. Return Number.shortValue() otherwise.
     *
     * @param columnIndex
     * @return
     */
    short getShort(int columnIndex);

    /**
     * Return default value (0) if the property is null. Return Number.shortValue() otherwise.
     *
     * @param columnName
     * @return
     */
    short getShort(String columnName);

    /**
     * Return default value (0) if the property is null. Return Number.intValue() otherwise.
     *
     * @param columnIndex
     * @return
     */
    int getInt(int columnIndex);

    /**
     * Return default value (0) if the property is null. Return Number.intValue() otherwise.
     *
     * @param columnName
     * @return
     */
    int getInt(String columnName);

    /**
     * Return default value (0) if the property is null. Return Number.longValue() otherwise.
     *
     * @param columnIndex
     * @return
     */
    long getLong(int columnIndex);

    /**
     * Return default value (0) if the property is null. Return Number.longValue() otherwise.
     *
     * @param columnName
     * @return
     */
    long getLong(String columnName);

    /**
     * Return default value (0f) if the property is null. Return Number.floatValue() otherwise.
     *
     * @param columnIndex
     * @return
     */
    float getFloat(int columnIndex);

    /**
     * Return default value (0f) if the property is null. Return Number.floatValue() otherwise.
     *
     * @param columnName
     * @return
     */
    float getFloat(String columnName);

    /**
     * Return default value (0d) if the property is null. Return Number.doubleValue() otherwise.
     *
     * @param columnIndex
     * @return
     */
    double getDouble(int columnIndex);

    /**
     * Return default value (0d) if the property is null. Return Number.doubleValue() otherwise.
     *
     * @param columnName
     * @return
     */
    double getDouble(String columnName);

    /**
     *
     * @param columnIndex
     * @return
     */
    boolean isNull(int columnIndex);

    /**
     *
     * @param columnName
     * @return
     */
    boolean isNull(String columnName);

    /**
     * Method set.
     *
     * @param columnIndex
     * @param value
     */
    void set(int columnIndex, Object value);

    /**
     * Method set.
     *
     * @param columnName
     * @param value
     */
    void set(String columnName, Object value);

    /**
     * Must NOT modify the returned list.
     *
     * @param columnIndex
     * @return
     */
     List getColumn(int columnIndex);

    /**
     * Must NOT modify the returned list.
     *
     * @param columnName
     * @return
     */
     List getColumn(String columnName);

    /**
     * Method addColumn.
     *
     * @param columnName
     * @param column
     */
    void addColumn(String columnName, List column);

    /**
     * Method addColumn.
     *
     * @param columnIndex position to add.
     * @param columnName
     * @param column
     */
    void addColumn(int columnIndex, String columnName, List column);

    /**
     * Generate the new column values from the specified column by the specified Function.
     * @param newColumnName
     * @param fromColumnName
     * @param func
     */
     void addColumn(String newColumnName, String fromColumnName, Try.Function func) throws E;

    /**
     * Generate the new column values from the specified column by the specified Function.
     * 
     * @param columnIndex
     * @param newColumnName
     * @param fromColumnName
     * @param func
     */
     void addColumn(int columnIndex, String newColumnName, String fromColumnName, Try.Function func) throws E;

    /**
     * Generate the new column values from the specified columns by the specified Function.
     * @param newColumnName
     * @param fromColumnNames
     * @param func
     */
     void addColumn(String newColumnName, Collection fromColumnNames, Try.Function func) throws E;

    /**
     * Generate the new column values from the specified columns by the specified Function.
     * 
     * @param columnIndex
     * @param newColumnName
     * @param fromColumnNames
     * @param func
     */
     void addColumn(int columnIndex, String newColumnName, Collection fromColumnNames, Try.Function func)
            throws E;

    /**
     * Remove the column with the specified columnName from this DataSet.
     *
     * @param columnName
     */
    void removeColumn(String columnName);

    /**
     * Remove the column(s) with the specified columnNames from this DataSet.
     *
     * @param columnNames
     */
    void removeColumnAll(Collection columnNames);

    /**
     * Update the values of the specified column by the specified function.
     *
     * @param columnName
     * @param func
     */
     void updateColumn(String columnName, Try.Function func) throws E;

    /**
     * Update the values of the specified columns one by one with the specified function.
     *
     * @param columnNames
     * @param func
     */
     void updateColumn(Collection columnNames, Try.Function func) throws E;

    /**
     * Convert the specified column to target type.
     *
     * @param columnName
     * @param targetType
     */
    void convertColumn(String columnName, Class targetType);

    /**
     * Convert the specified columns to target types.
     *
     * @param columnTargetTypes
     */
    void convertColumn(Map> columnTargetTypes);

    //
    //    /**
    //     * convert the specified columns to target types.
    //     *
    //     * @param targetColumnTypes fill the element with null if don't wan to convert the target column.
    //     */
    //    void convertColumn(Class[] targetColumnTypes);
    //
    /**
     *
     * @param columnNames
     * @param newColumnName
     * @param newColumnClass it can be Object[]/List/List/Set/Map/Entity
     * @return
     */
    void combineColumn(Collection columnNames, String newColumnName, Class newColumnClass);

     void combineColumn(Collection columnNames, String newColumnName, Try.Function combineFunc) throws E;

     void combineColumn(Try.Predicate columnNameFilter, String newColumnName, Class newColumnClass) throws E;

     void combineColumn(Try.Predicate columnNameFilter, String newColumnName,
            Try.Function combineFunc) throws E, E2;

     void divideColumn(String columnName, Collection newColumnNames, Try.Function, E> divideFunc) throws E;

    /**
     * 
     * @param row can be Object[]/List/Map/Entity with getter/setter methods
     */
    void addRow(Object row);

    /**
     * 
     * @param row can be Object[]/List/Map/Entity with getter/setter methods
     */
    void addRow(int rowIndex, Object row);

    /**
     * 
     * @param rowIndex
     */
    void removeRow(int rowIndex);

    /**
     * 
     * @param indices
     */
    void removeRowAll(int... indices);

    /**
     * 
     * @param inclusiveFromRowIndex
     * @param exclusiveToRowIndex
     */
    void removeRowRange(int inclusiveFromRowIndex, int exclusiveToRowIndex);

    /**
     * Update the values in the specified row with the specified function.
     * 
     * @param rowIndex
     * @param func
     */
     void updateRow(int rowIndex, Try.Function func) throws E;

    /**
     * Update the values in the specified rows one by one with the specified function.
     * 
     * @param indices
     * @param func
     */
     void updateRow(int[] indices, Try.Function func) throws E;

    /**
     * Update all the values in this DataSet with the specified function.
     * 
     * @param func
     */
     void updateAll(Try.Function func) throws E;

    /**
     * Replace all the values in this DataSet with the specified new value if it matches the specified condition.
     * 
     * @param func
     * @param newValue
     */
     void replaceIf(Try.Predicate func, Object newValue) throws E;

    /**
     * Returns the current row number.
     *
     * @return
     */
    int currentRowNum();

    /**
     * Move the cursor to the specified row.
     *
     * @param rowNum
     * @return this object itself.
     */
    DataSet absolute(int rowNum);

    /**
     *
     * @param rowNum
     * @return
     */
    Object[] getRow(int rowNum);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param rowNum
     * @return
     */
     T getRow(Class rowClass, int rowNum);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @param rowNum
     * @return
     */
     T getRow(Class rowClass, Collection columnNames, int rowNum);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param rowNum
     * @return
     */
     T getRow(IntFunction rowSupplier, int rowNum);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @param rowNum
     * @return
     */
     T getRow(IntFunction rowSupplier, Collection columnNames, int rowNum);

    /**
     *
     * @return {@code Optional}
     */
    Optional firstRow();

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @return {@code Optional}
     */
     Optional firstRow(Class rowClass);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @return {@code Optional}
     */
     Optional firstRow(Class rowClass, Collection columnNames);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @return {@code Optional}
     */
     Optional firstRow(IntFunction rowSupplier);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @return {@code Optional}
     */
     Optional firstRow(IntFunction rowSupplier, Collection columnNames);

    /**
     *
     * @return {@code Optional}
     */
    Optional lastRow();

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @return {@code Optional}
     */
     Optional lastRow(Class rowClass);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     *            which can be object array/list/set/map/entity.
     * @param columnNames
     * @return {@code Optional}
     */
     Optional lastRow(Class rowClass, Collection columnNames);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @return {@code Optional}
     */
     Optional lastRow(IntFunction rowSupplier);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @return {@code Optional}
     */
     Optional lastRow(IntFunction rowSupplier, Collection columnNames);

    //    /**
    //     * It's for faster iteration without creating new row object for each row.
    //     *
    //     * @param output
    //     *            which can be an instance of object array/list/set/map/entity.
    //     * @param rowNum
    //     */
    //    void row(Object output, int rowNum);
    //
    //    /**
    //     * It's for faster iteration without creating new row object for each row.
    //     *
    //     * @param output
    //     *            which can be an instance of object array/list/set/map/entity.
    //     * @param columnIndexes
    //     * @param rowNum
    //     */
    //    void row(Object output, int[] columnIndexes, int rowNum);

    /**
     * Performs the given action for each row of the {@code DataSet}
     * until all rows have been processed or the action throws an
     * exception.
     * 
     * @param action
     */
     void forEach(Try.Consumer action) throws E;

    /**
     * Performs the given action for each row of the {@code DataSet}
     * until all rows have been processed or the action throws an
     * exception.
     * @param action
     * @param shareRowArray the same object array will be reset for each row during the iteration if it's true. 
     * It can be set to true to improve the performance if the action only read each row object array once, don't modify it or save it in collection.
     * The default value is false.
     */
     void forEach(Try.Consumer action, boolean shareRowArray) throws E;

    /**
     * Performs the given action for each row of the {@code DataSet}
     * until all rows have been processed or the action throws an
     * exception.
     * 
     * @param columnNames
     * @param action
     */
     void forEach(Collection columnNames, Try.Consumer action) throws E;

    /**
     * Performs the given action for each row of the {@code DataSet}
     * until all rows have been processed or the action throws an
     * exception.
     * 
     * @param columnNames
     * @param action
     * @param shareRowArray the same object array will be reset for each row during the iteration if it's true. 
     * It can be set to true to improve the performance if the action only read each row object array once, don't modify it or save it in collection.
     * The default value is false.
     */
     void forEach(Collection columnNames, Try.Consumer action, boolean shareRowArray) throws E;

    /**
     * Performs the given action for each row of the {@code DataSet}
     * until all rows have been processed or the action throws an
     * exception.
     * 
     * @param fromRowIndex
     * @param toRowIndex
     * @param action
     */
     void forEach(int fromRowIndex, int toRowIndex, Try.Consumer action) throws E;

    /**
     * Performs the given action for each row of the {@code DataSet}
     * until all rows have been processed or the action throws an
     * exception.
     * 
     * @param fromRowIndex
     * @param toRowIndex
     * @param action
     * @param shareRowArray the same object array will be reset for each row during the iteration if it's true. 
     * It can be set to true to improve the performance if the action only read each row object array once, don't modify it or save it in collection.
     * The default value is false.
     */
     void forEach(int fromRowIndex, int toRowIndex, Try.Consumer action, boolean shareRowArray) throws E;

    /**
     * Performs the given action for each row of the {@code DataSet}
     * until all rows have been processed or the action throws an
     * exception.
     * 
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param action
     */
     void forEach(Collection columnNames, int fromRowIndex, int toRowIndex, Try.Consumer action) throws E;

    /**
     * Performs the given action for each row of the {@code DataSet}
     * until all rows have been processed or the action throws an
     * exception.
     * 
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param action
     * @param shareRowArray the same object array will be reset for each row during the iteration if it's true. 
     * It can be set to true to improve the performance if the action only read each row object array once, don't modify it or save it in collection.
     * The default value is false.
     */
     void forEach(Collection columnNames, int fromRowIndex, int toRowIndex, Try.Consumer action,
            boolean shareRowArray) throws E;

     R forEach(R seed, Try.BiFunction accumulator,
            Try.BiPredicate conditionToBreak) throws E, E2;

     R forEach(R seed, Try.BiFunction accumulator,
            Try.BiPredicate conditionToBreak, boolean shareRowArray) throws E, E2;

     R forEach(Collection columnNames, R seed, Try.BiFunction accumulator,
            Try.BiPredicate conditionToBreak) throws E, E2;

    /**
     * Execute accumulator on each element till true is returned by conditionToBreak
     * 
     * @param columnNames
     * @param seed The seed element is both the initial value of the reduction and the default result if there are no elements.
     * @param accumulator
     * @param conditionToBreak break if true is return.
     * @param shareRowArray
     * @return
     */
     R forEach(Collection columnNames, R seed, Try.BiFunction accumulator,
            Try.BiPredicate conditionToBreak, boolean shareRowArray) throws E, E2;

     R forEach(int fromRowIndex, int toRowIndex, R seed, Try.BiFunction accumulator,
            Try.BiPredicate conditionToBreak) throws E, E2;

     R forEach(int fromRowIndex, int toRowIndex, R seed, Try.BiFunction accumulator,
            Try.BiPredicate conditionToBreak, boolean shareRowArray) throws E, E2;

     R forEach(Collection columnNames, int fromRowIndex, int toRowIndex, R seed,
            Try.BiFunction accumulator, Try.BiPredicate conditionToBreak) throws E, E2;

    /**
     * Execute accumulator on each element till true is returned by conditionToBreak
     * 
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param seed The seed element is both the initial value of the reduction and the default result if there are no elements.
     * @param accumulator
     * @param conditionToBreak break if true is return.
     * @param shareRowArray
     * @return
     */
     R forEach(Collection columnNames, int fromRowIndex, int toRowIndex, R seed,
            Try.BiFunction accumulator, Try.BiPredicate conditionToBreak, boolean shareRowArray)
            throws E, E2;

    /**
     *
     * @return
     */
    Object[][] toArray();

    /**
     *
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    Object[][] toArray(int fromRowIndex, int toRowIndex);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @return
     */
     T[] toArray(Class rowClass);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity the class for the row value.
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     T[] toArray(Class rowClass, int fromRowIndex, int toRowIndex);

    /**
    *
    * @param rowClass it can be Object[]/List/List/Set/Map/Entity the class for the row value.
    * @param columnNames
    * @param fromRowIndex
    * @param toRowIndex
    * @return
    */
     T[] toArray(Class rowClass, Collection columnNames);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity the class for the row value.
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     T[] toArray(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity the class for the row value.
     * @return
     */
     T[] toArray(IntFunction rowSupplier);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity the class for the row value.
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     T[] toArray(IntFunction rowSupplier, int fromRowIndex, int toRowIndex);

    /**
    *
    * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity the class for the row value.
    * @param columnNames
    * @param fromRowIndex
    * @param toRowIndex
    * @return
    */
     T[] toArray(IntFunction rowSupplier, Collection columnNames);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity the class for the row value.
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     T[] toArray(IntFunction rowSupplier, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @return
     */
    List toList();

    /**
     *
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    List toList(int fromRowIndex, int toRowIndex);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @return
     */
     List toList(Class rowClass);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     List toList(Class rowClass, int fromRowIndex, int toRowIndex);

    /**
    *
    * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    * @param fromRowIndex
    * @param toRowIndex
    * @return
    */
     List toList(Class rowClass, Collection columnNames);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     List toList(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @return
     */
     List toList(IntFunction rowSupplier);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     List toList(IntFunction rowSupplier, int fromRowIndex, int toRowIndex);

    /**
    *
    * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
    * @param fromRowIndex
    * @param toRowIndex
    * @return
    */
     List toList(IntFunction rowSupplier, Collection columnNames);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     List toList(IntFunction rowSupplier, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param keyColumnName
     * @param valueColumnName
     * @return
     */
     Map toMap(String keyColumnName, String valueColumnName);

    /**
     *
     * @param keyColumnName
     * @param valueColumnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Map toMap(String keyColumnName, String valueColumnName, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param keyColumnName
     * @param valueColumnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param supplier
     * @return
     */
    > M toMap(String keyColumnName, String valueColumnName, int fromRowIndex, int toRowIndex, IntFunction supplier);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @return
     */
     Map toMap(Class rowClass, String keyColumnName, Collection valueColumnNames);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Map toMap(Class rowClass, String keyColumnName, Collection valueColumnNames, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param supplier
     * @return
     */
    > M toMap(Class rowClass, String keyColumnName, Collection valueColumnNames, int fromRowIndex,
            int toRowIndex, IntFunction supplier);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @return
     */
     Map toMap(IntFunction rowSupplier, String keyColumnName, Collection valueColumnNames);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Map toMap(IntFunction rowSupplier, String keyColumnName, Collection valueColumnNames, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param supplier
     * @return
     */
    > M toMap(IntFunction rowSupplier, String keyColumnName, Collection valueColumnNames, int fromRowIndex,
            int toRowIndex, IntFunction supplier);

    /**
     *
     * @param keyColumnName
     * @param valueColumnName
     * @return
     */
     ListMultimap toMultimap(String keyColumnName, String valueColumnName);

    /**
     *
     * @param keyColumnName
     * @param valueColumnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     ListMultimap toMultimap(String keyColumnName, String valueColumnName, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param keyColumnName
     * @param valueColumnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param supplier
     * @return
     */
    , M extends Multimap> M toMultimap(String keyColumnName, String valueColumnName, int fromRowIndex, int toRowIndex,
            IntFunction supplier);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @return
     */
     ListMultimap toMultimap(Class rowClass, String keyColumnName, Collection valueColumnNames);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     ListMultimap toMultimap(Class rowClass, String keyColumnName, Collection valueColumnNames, int fromRowIndex,
            int toRowIndex);

    /**
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param supplier
     * @return
     */
    , M extends Multimap> M toMultimap(Class rowClass, String keyColumnName,
            Collection valueColumnNames, int fromRowIndex, int toRowIndex, IntFunction supplier);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @return
     */
     ListMultimap toMultimap(IntFunction rowSupplier, String keyColumnName, Collection valueColumnNames);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     ListMultimap toMultimap(IntFunction rowSupplier, String keyColumnName, Collection valueColumnNames, int fromRowIndex,
            int toRowIndex);

    /**
     * 
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param keyColumnName
     * @param valueColumnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param supplier
     * @return
     */
    , M extends Multimap> M toMultimap(IntFunction rowSupplier, String keyColumnName,
            Collection valueColumnNames, int fromRowIndex, int toRowIndex, IntFunction supplier);

    /**
     *
     * @param columnName
     * @return
     */
     Multiset toMultiset(String columnName);

    /**
     *
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Multiset toMultiset(String columnName, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param supplier create Multiset by new Multiset(ArrayHashMap.class) or Multiset(LinkedArrayHashMap.class) if the element is array.
     * @return
     */
     Multiset toMultiset(String columnName, int fromRowIndex, int toRowIndex, IntFunction> supplier);

    /**
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @return
     */
     Multiset toMultiset(Class rowClass, Collection columnNames);

    /**
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Multiset toMultiset(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param supplier create Multiset by new Multiset(ArrayHashMap.class) or Multiset(LinkedArrayHashMap.class) if rowClass is array.
     * @return
     */
     Multiset toMultiset(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex,
            IntFunction> supplier);

    /**
     * 
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @return
     */
     Multiset toMultiset(IntFunction rowSupplier, Collection columnNames);

    /**
     * 
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Multiset toMultiset(IntFunction rowSupplier, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param supplier create Multiset by new Multiset(ArrayHashMap.class) or Multiset(LinkedArrayHashMap.class) if rowClass is array.
     * @return
     */
     Multiset toMultiset(IntFunction rowSupplier, Collection columnNames, int fromRowIndex, int toRowIndex,
            IntFunction> supplier);

    /**
     *
     * @return
     */
    String toJSON();

    /**
     *
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    String toJSON(int fromRowIndex, int toRowIndex);

    /**
     *
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    String toJSON(Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
    *
    * @param out
    */
    void toJSON(File out);

    /**
    *
    * @param out
    * @param fromRowIndex
    * @param toRowIndex
    */
    void toJSON(File out, int fromRowIndex, int toRowIndex);

    /**
    *
    * @param out
    * @param columnNames
    * @param fromRowIndex
    * @param toRowIndex
    */
    void toJSON(File out, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param os
     */
    void toJSON(OutputStream out);

    /**
     *
     * @param os
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toJSON(OutputStream out, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param os
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toJSON(OutputStream out, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param os
     */
    void toJSON(Writer out);

    /**
     *
     * @param os
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toJSON(Writer out, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param os
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toJSON(Writer out, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @return
     */
    String toXML();

    /**
     * @param rowElementName
     * @return
     */
    String toXML(String rowElementName);

    /**
     *
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    String toXML(int fromRowIndex, int toRowIndex);

    /**
     * @param rowElementName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    String toXML(String rowElementName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    String toXML(Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * @param rowElementName
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    String toXML(String rowElementName, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * @param out
     */
    void toXML(File out);

    /**
     * @param out
     * @param rowElementName
     */
    void toXML(File out, String rowElementName);

    /**
     *
     * @param out
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(File out, int fromRowIndex, int toRowIndex);

    /**
     * @param out
     * @param rowElementName
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(File out, String rowElementName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param out
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(File out, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * @param out
     * @param rowElementName
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(File out, String rowElementName, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * @param out
     */
    void toXML(OutputStream out);

    /**
     * @param out
     * @param rowElementName
     */
    void toXML(OutputStream out, String rowElementName);

    /**
     *
     * @param out
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(OutputStream out, int fromRowIndex, int toRowIndex);

    /**
     * @param out
     * @param rowElementName
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(OutputStream out, String rowElementName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param out
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(OutputStream out, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * @param out
     * @param rowElementName
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(OutputStream out, String rowElementName, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * @param out
     */
    void toXML(Writer out);

    /**
     * @param out
     * @param rowElementName
     */
    void toXML(Writer out, String rowElementName);

    /**
     *
     * @param out
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(Writer out, int fromRowIndex, int toRowIndex);

    /**
     * @param out
     * @param rowElementName
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(Writer out, String rowElementName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param out
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(Writer out, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * @param out
     * @param rowElementName
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toXML(Writer out, String rowElementName, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     */
    String toCSV();

    /**
     *
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    String toCSV(Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param writeTitle
     * @param quoteValue
     * @return
     */
    String toCSV(boolean writeTitle, boolean quoteValue);

    /**
     *
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param writeTitle
     * @param quoteValue
     * @return
     */
    String toCSV(Collection columnNames, int fromRowIndex, int toRowIndex, boolean writeTitle, boolean quoteValue);

    /**
     *
     * @param out
     */
    void toCSV(File out);

    /**
     *
     * @param out
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toCSV(File out, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param out
     * @param writeTitle
     * @param quoteValue
     */
    void toCSV(File out, boolean writeTitle, boolean quoteValue);

    /**
     *
     * @param out
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param writeTitle
     * @param quoteValue
     */
    void toCSV(File out, Collection columnNames, int fromRowIndex, int toRowIndex, boolean writeTitle, boolean quoteValue);

    /**
     *
     * @param out
     */
    void toCSV(OutputStream out);

    /**
     *
     * @param out
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toCSV(OutputStream out, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param out
     * @param writeTitle
     * @param quoteValue
     */
    void toCSV(OutputStream out, boolean writeTitle, boolean quoteValue);

    /**
     *
     * @param out
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param writeTitle
     * @param quoteValue
     */
    void toCSV(OutputStream out, Collection columnNames, int fromRowIndex, int toRowIndex, boolean writeTitle, boolean quoteValue);

    /**
     *
     * @param out
     */
    void toCSV(Writer out);

    /**
     *
     * @param out
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    void toCSV(Writer out, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param out
     * @param writeTitle
     * @param quoteValue
     */
    void toCSV(Writer out, boolean writeTitle, boolean quoteValue);

    /**
     *
     * @param out
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param writeTitle
     * @param quoteValue
     */
    void toCSV(Writer out, Collection columnNames, int fromRowIndex, int toRowIndex, boolean writeTitle, boolean quoteValue);

    /**
     *
     * @param columnName
     */
    void sortBy(String columnName);

    /**
     *
     * @param columnName
     * @param cmp
     */
    void sortBy(String columnName, Comparator cmp);

    /**
     *
     * @param columnNames
     */
    void sortBy(Collection columnNames);

    /**
     *
     * @param columnNames
     * @param cmp
     */
    void sortBy(Collection columnNames, Comparator cmp);

    /**
     *
     * @param columnName
     */
    void parallelSortBy(String columnName);

    /**
     *
     * @param columnName
     * @param cmp
     */
    void parallelSortBy(String columnName, Comparator cmp);

    /**
     *
     * @param columnNames
     */
    void parallelSortBy(Collection columnNames);

    /**
     *
     * @param columnNames
     * @param cmp
     */
    void parallelSortBy(Collection columnNames, Comparator cmp);

    /**
     *
     * @param columnName specifying the column to group by.
     * @return
     */
    DataSet groupBy(String columnName);

    /**
     * 
     * @param columnName specifying the column to group by.
     * @param keyExtractor don't change value of the input parameter.
     * @return
     */
     DataSet groupBy(String columnName, Try.Function keyExtractor) throws E;

    /**
     * 
     * @param columnName specifying the column to group by.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnName specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
    DataSet groupBy(String columnName, String aggregateResultColumnName, String aggregateOnColumnName, Collector collector);

    /**
     * 
     * @param columnName specifying the column to group by.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnNames specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
    DataSet groupBy(String columnName, String aggregateResultColumnName, Collection aggregateOnColumnNames,
            Collector collector);

    /**
     * 
     * @param columnName specifying the column to group by. 
     * @param keyExtractor don't change value of the input parameter.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnName specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
     DataSet groupBy(String columnName, Try.Function keyExtractor, String aggregateResultColumnName, String aggregateOnColumnName,
            Collector collector) throws E;

    /**
     * 
     * @param columnName specifying the column to group by.
     * @param keyExtractor don't change value of the input parameter.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnNames specifying the columns to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
     DataSet groupBy(String columnName, Try.Function keyExtractor, String aggregateResultColumnName,
            Collection aggregateOnColumnNames, Collector collector) throws E;

    /**
     *
     * @param columnName specifying the column to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    DataSet groupBy(String columnName, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param columnName specifying the column to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param keyExtractor don't change value of the input parameter.
     * @return
     */
     DataSet groupBy(String columnName, int fromRowIndex, int toRowIndex, Try.Function keyExtractor) throws E;

    /**
     * 
     * @param columnName specifying the column to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param aggregateResultColumnName
     * @param aggregateOnColumnName specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
    DataSet groupBy(String columnName, int fromRowIndex, int toRowIndex, String aggregateResultColumnName, String aggregateOnColumnName,
            Collector collector);

    /**
     * 
     * @param columnName specifying the column to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param aggregateResultColumnName
     * @param aggregateOnColumnNames specifying the columns to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
    DataSet groupBy(String columnName, int fromRowIndex, int toRowIndex, String aggregateResultColumnName, Collection aggregateOnColumnNames,
            Collector collector);

    /**
     * 
     * @param columnName specifying the column to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param keyExtractor don't change value of the input parameter.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnName specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
     DataSet groupBy(String columnName, int fromRowIndex, int toRowIndex, Try.Function keyExtractor,
            String aggregateResultColumnName, String aggregateOnColumnName, Collector collector) throws E;

    /**
     * 
     * @param columnName specifying the column to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param keyExtractor don't change value of the input parameter.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnNames specifying the columns to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
     DataSet groupBy(String columnName, int fromRowIndex, int toRowIndex, Try.Function keyExtractor,
            String aggregateResultColumnName, Collection aggregateOnColumnNames, Collector collector) throws E;

    /**
     *
     * @param columnNames specifying the columns to group by.
     * @return
     */
    DataSet groupBy(Collection columnNames);

    /**
     * 
     * @param columnNames specifying the columns to group by. 
     * @param keyExtractor don't change value of the input parameter. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
     DataSet groupBy(Collection columnNames, Try.Function keyExtractor) throws E;

    /**
     * 
     * @param columnNames specifying the columns to group by.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnName specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
    DataSet groupBy(Collection columnNames, String aggregateResultColumnName, String aggregateOnColumnName, Collector collector);

    /**
     * 
     * @param columnNames specifying the columns to group by.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnNames specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
    DataSet groupBy(Collection columnNames, String aggregateResultColumnName, Collection aggregateOnColumnNames,
            Collector collector);

    /**
     * 
     * @param columnNames specifying the columns to group by. 
     * @param keyExtractor don't change value of the input parameter.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnName specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
     DataSet groupBy(Collection columnNames, Try.Function keyExtractor, String aggregateResultColumnName,
            String aggregateOnColumnName, Collector collector) throws E;

    /**
     * 
     * @param columnNames specifying the columns to group by. 
     * @param keyExtractor don't change value of the input parameter.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnNames specifying the columns to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
     DataSet groupBy(Collection columnNames, Try.Function keyExtractor, String aggregateResultColumnName,
            Collection aggregateOnColumnNames, Collector collector) throws E;

    /**
     *
     * @param columnNames specifying the columns to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    DataSet groupBy(Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param columnNames specifying the columns to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param keyExtractor don't change value of the input parameter.
     * @return
     */
     DataSet groupBy(Collection columnNames, int fromRowIndex, int toRowIndex, Try.Function keyExtractor)
            throws E;

    /**
     * 
     * @param columnNames specifying the columns to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param aggregateResultColumnName
     * @param aggregateOnColumnName specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
    DataSet groupBy(Collection columnNames, int fromRowIndex, int toRowIndex, String aggregateResultColumnName, String aggregateOnColumnName,
            Collector collector);

    /**
     * 
     * @param columnNames specifying the columns to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param aggregateResultColumnName
     * @param aggregateOnColumnNames specifying the columns to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
    DataSet groupBy(Collection columnNames, int fromRowIndex, int toRowIndex, String aggregateResultColumnName,
            Collection aggregateOnColumnNames, Collector collector);

    /**
     * 
     * @param columnNames specifying the columns to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param keyExtractor don't change value of the input parameter.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnName specifying the column to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
     DataSet groupBy(Collection columnNames, int fromRowIndex, int toRowIndex, Try.Function keyExtractor,
            String aggregateResultColumnName, String aggregateOnColumnName, Collector collector) throws E;

    /**
     * 
     * @param columnNames specifying the columns to group by.
     * @param fromRowIndex
     * @param toRowIndex
     * @param keyExtractor don't change value of the input parameter.
     * @param aggregateResultColumnName
     * @param aggregateOnColumnNames specifying the columns to apply the collector.
     * @param collector refer to {@link com.landawn.abacus.util.stream.Collectors#groupingBy(Function, Collector)}. 
     * For example, set collector to {@link com.landawn.abacus.util.stream.Collectors#counting()} to count the row number.
     * @return
     */
     DataSet groupBy(Collection columnNames, int fromRowIndex, int toRowIndex, Try.Function keyExtractor,
            String aggregateResultColumnName, Collection aggregateOnColumnNames, Collector collector) throws E;

    /**
     *
     * @param columnName
     * @param n
     * @return
     */
    DataSet top(String columnName, int n);

    /**
     *
     * @param columnName
     * @param n
     * @param cmp
     * @return
     */
    DataSet top(String columnName, int n, Comparator cmp);

    /**
     *
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param n
     * @param cmp
     * @return
     */
    DataSet top(String columnName, int fromRowIndex, int toRowIndex, int n, Comparator cmp);

    /**
    *
    * @param columnNames
    * @param n
    * @return
    */
    DataSet top(Collection columnNames, int n);

    /**
     *
     * @param columnNames
     * @param n
     * @param cmp
     * @return
     */
    DataSet top(Collection columnNames, int n, Comparator cmp);

    /**
     *
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param n
     * @param cmp
     * @return
     */
    DataSet top(Collection columnNames, int fromRowIndex, int toRowIndex, int n, Comparator cmp);

    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnName
    //     * @param n
    //     * @return
    //     */
    //     List top(Class rowClass, String columnName, int n);
    //
    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnName
    //     * @param n
    //     * @param cmp
    //     * @return
    //     */
    //     List top(Class rowClass, String columnName, int n, Comparator cmp);
    //
    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnName
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param n
    //     * @param cmp
    //     * @return
    //     */
    //     List top(Class rowClass, String columnName, int fromRowIndex, int toRowIndex, int n, Comparator cmp);
    //
    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnNames
    //     * @param n
    //     * @return
    //     */
    //     List top(Class rowClass, Collection columnNames, int n);
    //
    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnNames
    //     * @param n
    //     * @param cmp
    //     * @return
    //     */
    //     List top(Class rowClass, Collection columnNames, int n, Comparator cmp);
    //
    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnNames
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param n
    //     * @param cmp
    //     * @return
    //     */
    //     List top(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex, int n, Comparator cmp);

    /**
     * Returns a new DataSet with the rows de-duplicated by the values in all columns
     *
     * @return a new DataSet
     */
    DataSet distinct();

    /**
     * Returns a new DataSet with the rows de-duplicated by the value in the specified column
     *
     * @param columnName
     * @return a new DataSet
     */
    DataSet distinct(String columnName);

    /**
     * Returns a new DataSet with the rows de-duplicated by the value in the specified column from the specified fromRowIndex to toRowIndex
     *
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return a new DataSet
     */
    DataSet distinct(String columnName, int fromRowIndex, int toRowIndex);

    /**
     * Returns a new DataSet with the rows de-duplicated by the values in the specified columns
     *
     * @param columnNames
     * @return a new DataSet
     */
    DataSet distinct(Collection columnNames);

    /**
     *Returns a new DataSet with the rows de-duplicated by the values in the specified columns from the specified fromRowIndex to toRowIndex
     *
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    DataSet distinct(Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * Returns a new DataSet with the rows de-duplicated by the value in the specified column from the specified fromRowIndex to toRowIndex
     * 
     * @param columnName
     * @param keyExtractor don't change value of the input parameter.
     * @return
     */
     DataSet distinctBy(String columnName, Try.Function keyExtractor) throws E;

    /**
     * Returns a new DataSet with the rows de-duplicated by the value in the specified column from the specified fromRowIndex to toRowIndex
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param keyExtractor don't change value of the input parameter.
     * @return
     */
     DataSet distinctBy(String columnName, int fromRowIndex, int toRowIndex, Try.Function keyExtractor) throws E;

    /**
     * Returns a new DataSet with the rows de-duplicated by the values in the specified columns from the specified fromRowIndex to toRowIndex
     * 
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param keyExtractor don't change value of the input parameter.
     * @return
     */
     DataSet distinctBy(Collection columnNames, Try.Function keyExtractor) throws E;

    /**
     * Returns a new DataSet with the rows de-duplicated by the values in the specified columns from the specified fromRowIndex to toRowIndex
     * 
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param keyExtractor don't change value of the input parameter.
     * @return
     */
     DataSet distinctBy(Collection columnNames, int fromRowIndex, int toRowIndex,
            Try.Function keyExtractor) throws E;

    /**
     *
     * @param filter
     * @return
     */
     DataSet filter(Try.Predicate filter) throws E;

    /**
     * 
     * @param filter
     * @param max
     * @return
     */
     DataSet filter(Try.Predicate filter, int max) throws E;

    /**
     *
     * @param fromRowIndex
     * @param toRowIndex
     * @param filter
     * @return
     */
     DataSet filter(int fromRowIndex, int toRowIndex, Try.Predicate filter) throws E;

    /**
     * 
     * @param fromRowIndex
     * @param toRowIndex
     * @param filter
     * @param max
     * @return
     */
     DataSet filter(int fromRowIndex, int toRowIndex, Try.Predicate filter, int max) throws E;

    /**
     *
     * @param columnName
     * @param filter
     * @return
     */
     DataSet filter(String columnName, Try.Predicate filter) throws E;

    /**
     * 
     * @param columnName
     * @param filter
     * @param max
     * @return
     */
     DataSet filter(String columnName, Try.Predicate filter, int max) throws E;

    /**
     *
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param filter
     * @return
     */
     DataSet filter(String columnName, int fromRowIndex, int toRowIndex, Try.Predicate filter) throws E;

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param filter
     * @param max
     * @return
     */
     DataSet filter(String columnName, int fromRowIndex, int toRowIndex, Try.Predicate filter, int max) throws E;

    //    /**
    //     *
    //     * @param columnName
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @param offset
    //     * @param count
    //     * @return
    //     */
    //     DataSet filter(String columnName, int fromRowIndex, int toRowIndex, Predicate filter, int offset, int count);

    /**
     *
     * @param columnNames
     * @param filter
     * @return
     */
     DataSet filter(Collection columnNames, Try.Predicate filter) throws E;

    /**
     * 
     * @param columnNames
     * @param filter
     * @param max
     * @return
     */
     DataSet filter(Collection columnNames, Try.Predicate filter, int max) throws E;

    /**
     *
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param filter
     * @return
     */
     DataSet filter(Collection columnNames, int fromRowIndex, int toRowIndex, Try.Predicate filter) throws E;

    /**
     * 
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param filter
     * @param max
     * @return
     */
     DataSet filter(Collection columnNames, int fromRowIndex, int toRowIndex, Try.Predicate filter, int max)
            throws E;

    //    /**
    //     * Filter the result by the specified columns {@code columnNames} with the specified {@code filter}.
    //     * @param columnNames
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @param offset
    //     * @param count
    //     * @return
    //     */
    //     DataSet filter(Collection columnNames, int fromRowIndex, int toRowIndex, Try.Predicate filter, int offset, int count);

    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param filter
    //     * @return
    //     */
    //     List filter(Class rowClass, Try.Predicate filter) throws E;
    //
    //    /**
    //     * 
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param filter
    //     * @param max
    //     * @return
    //     */
    //     List filter(Class rowClass, Try.Predicate filter, int max);
    //
    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @return
    //     */
    //     List filter(Class rowClass, int fromRowIndex, int toRowIndex, Try.Predicate filter) throws E;
    //
    //    /**
    //     * 
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @param max
    //     * @return
    //     */
    //     List filter(Class rowClass, int fromRowIndex, int toRowIndex, Try.Predicate filter, int max);
    //
    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnName
    //     * @param filter
    //     * @return
    //     */
    //     List filter(Class rowClass, String columnName, Try.Predicate filter) throws E;
    //
    //    /**
    //     * 
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnName
    //     * @param filter
    //     * @param max
    //     * @return
    //     */
    //     List filter(Class rowClass, String columnName, Try.Predicate filter, int max);
    //
    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnName
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @return
    //     */
    //     List filter(Class rowClass, String columnName, int fromRowIndex, int toRowIndex, Try.Predicate filter) throws E;
    //
    //    /**
    //     * 
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnName
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @param max
    //     * @return
    //     */
    //     List filter(Class rowClass, String columnName, int fromRowIndex, int toRowIndex, Try.Predicate filter, int max);

    //    /**
    //     * 
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnName
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @param offset
    //     * @param count
    //     * @return
    //     */
    //     List filter(Class rowClass, String columnName, int fromRowIndex, int toRowIndex, Predicate filter, int offset, int count);

    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnNames
    //     * @param filter
    //     * @return
    //     */
    //     List filter(Class rowClass, Collection columnNames, Try.Predicate filter) throws E;
    //
    //    /**
    //     * 
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnNames
    //     * @param filter
    //     * @param max
    //     * @return
    //     */
    //     List filter(Class rowClass, Collection columnNames, Try.Predicate filter, int max);
    //
    //    /**
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnNames
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @return
    //     */
    //     List filter(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex, Try.Predicate filter) throws E;
    //
    //    /**
    //     * 
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     * @param columnNames
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @param max
    //     * @return
    //     */
    //     List filter(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex, Try.Predicate filter, int max);

    //    /**
    //     * Filter the result by the specified columns {@code columnNames} with the specified {@code filter}.
    //     *
    //     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
    //     *            which can be list/set/map/entity with getter/setter methods
    //     * @param columnNames
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param filter
    //     * @param offset
    //     * @param count
    //     * @return the a list of row
    //     */
    //     List filter(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex, Try.Predicate filter, int offset, int count);

    /**
     *
     * @param filter
     * @return
     */
     int count(Try.Predicate filter) throws E;

    /**
     *
     * @param fromRowIndex
     * @param toRowIndex
     * @param filter
     * @return
     */
     int count(int fromRowIndex, int toRowIndex, Try.Predicate filter) throws E;

    /**
    *
    * @param columnName
    * @param filter
    * @return
    */
     int count(String columnName, Try.Predicate filter) throws E;

    /**
    * count the result by the specified columns {@code columnName} with the specified {@code filter}.
    *
    * @param columnName
    * @param fromRowIndex
    * @param toRowIndex
    * @param filter
    * @return
    */
     int count(String columnName, int fromRowIndex, int toRowIndex, Try.Predicate filter) throws E;

    /**
     *
     * @param columnNames
     * @param filter
     * @return
     */
     int count(Collection columnNames, Try.Predicate filter) throws E;

    /**
     * count the result by the specified columns {@code columnNames} with the specified {@code filter}.
     *
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param filter
     * @return
     */
     int count(Collection columnNames, int fromRowIndex, int toRowIndex, Try.Predicate filter) throws E;

    /**
     * @param columnName
     * @return
     */
    > Nullable min(String columnName);

    /**
     *
     * @param columnName
     * @param comparator
     * @return
     */
     Nullable min(String columnName, Comparator comparator);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    > Nullable min(String columnName, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param comparator
     * @return
     */
     Nullable min(String columnName, int fromRowIndex, int toRowIndex, Comparator comparator);

    /**
     * @param columnName
     * @return
     */
    > Nullable max(String columnName);

    /**
     *
     * @param columnName
     * @param comparator
     * @return
     */
     Nullable max(String columnName, Comparator comparator);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    > Nullable max(String columnName, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param comparator
     * @return
     */
     Nullable max(String columnName, int fromRowIndex, int toRowIndex, Comparator comparator);

    /**
     * @param columnName
     * @return
     */
    > Nullable median(String columnName);

    /**
     *
     * @param columnName
     * @param comparator
     * @return
     */
     Nullable median(String columnName, Comparator comparator);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    > Nullable median(String columnName, int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param comparator
     * @return
     */
     Nullable median(String columnName, int fromRowIndex, int toRowIndex, Comparator comparator);

    /**
     * @param columnName
     * @param k
     * @return
     */
    > Nullable kthLargest(String columnName, int k);

    /**
     *
     * @param columnName
     * @param k
     * @param comparator
     * @return
     */
     Nullable kthLargest(String columnName, int k, Comparator comparator);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param k
     * @return
     */
    > Nullable kthLargest(String columnName, int fromRowIndex, int toRowIndex, int k);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param k
     * @param comparator
     * @return
     */
     Nullable kthLargest(String columnName, int fromRowIndex, int toRowIndex, int k, Comparator comparator);

    /**
     * @param columnName
     * @return
     */
    int sumInt(String columnName);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    int sumInt(String columnName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param columnName
     * @param mapper
     * @return
     */
     int sumInt(String columnName, Try.ToIntFunction mapper) throws E;

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param mapper
     * @return
     */
     int sumInt(String columnName, int fromRowIndex, int toRowIndex, Try.ToIntFunction mapper) throws E;

    /**
     * @param columnName
     * @return
     */
    long sumLong(String columnName);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    long sumLong(String columnName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param columnName
     * @param mapper
     * @return
     */
     long sumLong(String columnName, Try.ToLongFunction mapper) throws E;

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param mapper
     * @return
     */
     long sumLong(String columnName, int fromRowIndex, int toRowIndex, Try.ToLongFunction mapper) throws E;

    /**
     * @param columnName
     * @return
     */
    double sumDouble(String columnName);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    double sumDouble(String columnName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param columnName
     * @param mapper
     * @return
     */
     double sumDouble(String columnName, Try.ToDoubleFunction mapper) throws E;

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param mapper
     * @return
     */
     double sumDouble(String columnName, int fromRowIndex, int toRowIndex, Try.ToDoubleFunction mapper) throws E;

    /**
     * @param columnName
     * @return
     */
    OptionalDouble averageInt(String columnName);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    OptionalDouble averageInt(String columnName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param columnName
     * @param mapper
     * @return
     */
     OptionalDouble averageInt(String columnName, Try.ToIntFunction mapper) throws E;

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param mapper
     * @return
     */
     OptionalDouble averageInt(String columnName, int fromRowIndex, int toRowIndex, Try.ToIntFunction mapper) throws E;

    /**
     * @param columnName
     * @return
     */
    OptionalDouble averageLong(String columnName);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    OptionalDouble averageLong(String columnName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param columnName
     * @param mapper
     * @return
     */
     OptionalDouble averageLong(String columnName, Try.ToLongFunction mapper) throws E;

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param mapper
     * @return
     */
     OptionalDouble averageLong(String columnName, int fromRowIndex, int toRowIndex, Try.ToLongFunction mapper) throws E;

    /**
     * @param columnName
     * @return
     */
    OptionalDouble averageDouble(String columnName);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    OptionalDouble averageDouble(String columnName, int fromRowIndex, int toRowIndex);

    //    /**
    //     *
    //     * @param columnName
    //     * @param mapper
    //     * @return
    //     */
    //    OptionalDouble average(String columnName, Try.ToLongFunction mapper) throws E;
    //
    //    /**
    //     * 
    //     * @param columnName
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @param mapper
    //     * @return
    //     */
    //    OptionalDouble average(String columnName, int fromRowIndex, int toRowIndex, Try.ToLongFunction mapper) throws E;

    /**
     *
     * @param columnName
     * @param mapper
     * @return
     */
     OptionalDouble averageDouble(String columnName, Try.ToDoubleFunction mapper) throws E;

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @param mapper
     * @return
     */
     OptionalDouble averageDouble(String columnName, int fromRowIndex, int toRowIndex, Try.ToDoubleFunction mapper) throws E;

    // TODO
    //    /**
    //     * @param columnNames
    //     * @return a copy of this DataSet
    //     * @see List#subList(int, int).
    //     */
    //    DataSet slice(Collection columnNames);
    //
    //    /**
    //     *
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @return a copy of this DataSet
    //     * @see List#subList(int, int).
    //     */
    //    DataSet slice(int fromRowIndex, int toRowIndex);
    //
    //    /**
    //     *
    //     * @param columnNames
    //     * @param fromRowIndex
    //     * @param toRowIndex
    //     * @return a copy of this DataSet
    //     * @see List#subList(int, int).
    //     */
    //    DataSet slice(Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * Returns the copy of this DataSet.
     * The frozen status of the copy will always be false, even the original DataSet is frozen.
     *
     * @return a copy of this DataSet
     */
    DataSet copy();

    /**
     * Returns the copy of this DataSet with specified column name list.
     * The frozen status of the copy will always be false, even the original DataSet is frozen.
     *
     * @param columnNames
     * @return a copy of this DataSet
     */
    DataSet copy(Collection columnNames);

    /**
     * Returns the copy of this DataSet from the specified fromRowIndex to toRowIndex.
     * The frozen status of the copy will always be false, even the original DataSet is frozen.
     *
     * @param fromRowIndex
     * @param toRowIndex
     * @return a copy of this DataSet
     */
    DataSet copy(int fromRowIndex, int toRowIndex);

    /**
     * Returns the copy of this DataSet with specified column name list from the specified fromRowIndex to toRowIndex.
     * The frozen status of the copy will always be false, even the original DataSet is frozen.
     *
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return a copy of this DataSet
     */
    DataSet copy(Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * Deeply copy each element in this DataSet by Serialization/Deserialization.
     * 
     * @return
     */
    DataSet clone();

    /**
     * Deeply copy each element in this DataSet by Serialization/Deserialization.
     * 
     * @return
     */
    DataSet clone(boolean freeze);

    /**
     * Returns a new DataSet that is limited to the rows where there is a match in both this DataSet and right DataSet.
     *
     * @param right
     * @param columnName
     * @param refColumnName
     * @return a new DataSet
     */
    DataSet join(DataSet right, String columnName, String refColumnName);

    /**
     * Returns a new DataSet that is limited to the rows where there is a match in both this DataSet and right DataSet.
     *
     * @param right
     * @param onColumnNames
     * @return a new DataSet
     */
    DataSet join(DataSet right, Map onColumnNames);

    /**
     * Returns a new DataSet that is limited to the rows where there is a match in both this DataSet and right DataSet.
     *
     * @param right
     * @param onColumnNames
     * @param newColumnName
     * @param newColumnClass it can be Object[]/List/List/Set/Map/Entity
     * @return a new DataSet
     */
    DataSet join(DataSet right, Map onColumnNames, String newColumnName, Class newColumnClass);

    /**
     * Returns a new DataSet that is limited to the rows where there is a match in both this DataSet and right DataSet.
     *
     * @param right
     * @param onColumnNames
     * @param newColumnName
     * @param newColumnClass it can be Object[]/List/List/Set/Map/Entity
     * @param collClass it's for one-to-many join
     * @return a new DataSet
     */
    @SuppressWarnings("rawtypes")
    DataSet join(DataSet right, Map onColumnNames, String newColumnName, Class newColumnClass, Class collClass);

    /**
     * Returns a new DataSet that has all the rows from this DataSet and the rows from the specified right DataSet if they have a match with the rows from the this DataSet.
     *
     * @param right
     * @param columnName
     * @param refColumnName
     * @return a new DataSet
     */
    DataSet leftJoin(DataSet right, String columnName, String refColumnName);

    /**
     * Returns a new DataSet that has all the rows from this DataSet and the rows from the specified right DataSet if they have a match with the rows from the this DataSet.
     *
     * @param right
     * @param onColumnNames
     * @return a new DataSet
     */
    DataSet leftJoin(DataSet right, Map onColumnNames);

    /**
     * Returns a new DataSet that has all the rows from this DataSet and the rows from the specified right DataSet if they have a match with the rows from the this DataSet.
     *
     * @param right
     * @param onColumnNames
     * @param newColumnName
     * @param newColumnClass it can be Object[]/List/List/Set/Map/Entity
     * @return a new DataSet
     */
    DataSet leftJoin(DataSet right, Map onColumnNames, String newColumnName, Class newColumnClass);

    /**
     * Returns a new DataSet that has all the rows from this DataSet and the rows from the specified right DataSet if they have a match with the rows from the this DataSet.
     *
     * @param right
     * @param onColumnNames
     * @param newColumnName
     * @param newColumnClass it can be Object[]/List/List/Set/Map/Entity
     * @param collClass it's for one-to-many join
     * @return a new DataSet
     */
    @SuppressWarnings("rawtypes")
    DataSet leftJoin(DataSet right, Map onColumnNames, String newColumnName, Class newColumnClass, Class collClass);

    /**
     * Returns a new DataSet that has all the rows from the specified right DataSet and the rows from this DataSet if they have a match with the rows from the right DataSet.
     *
     * @param right
     * @param columnName
     * @param refColumnName
     * @return a new DataSet
     */
    DataSet rightJoin(DataSet right, String columnName, String refColumnName);

    /**
     * Returns a new DataSet that has all the rows from the specified right DataSet and the rows from this DataSet if they have a match with the rows from the right DataSet.
     *
     * @param right
     * @param onColumnNames
     * @return a new DataSet
     */
    DataSet rightJoin(DataSet right, Map onColumnNames);

    /**
     * Returns a new DataSet that has all the rows from the specified right DataSet and the rows from this DataSet if they have a match with the rows from the right DataSet.
     *
     * @param right
     * @param onColumnNames
     * @param newColumnName
     * @param newColumnClass it can be Object[]/List/List/Set/Map/Entity
     * @return a new DataSet
     */
    DataSet rightJoin(DataSet right, Map onColumnNames, String newColumnName, Class newColumnClass);

    /**
     * Returns a new DataSet that has all the rows from the specified right DataSet and the rows from this DataSet if they have a match with the rows from the right DataSet.
     *
     * @param right
     * @param onColumnNames
     * @param newColumnName
     * @param newColumnClass it can be Object[]/List/List/Set/Map/Entity
     * @param collClass it's for one-to-many join
     * @return a new DataSet
     */
    @SuppressWarnings("rawtypes")
    DataSet rightJoin(DataSet right, Map onColumnNames, String newColumnName, Class newColumnClass, Class collClass);

    /**
     * Returns a new DataSet that has all the rows from this DataSet and the specified right DataSet, regardless of whether there are any matches.
     *
     * @param right
     * @param columnName
     * @param refColumnName
     * @return a new DataSet
     */
    DataSet fullJoin(DataSet right, String columnName, String refColumnName);

    /**
     * Returns a new DataSet that has all the rows from this DataSet and the specified right DataSet, regardless of whether there are any matches.
     *
     * @param right
     * @param onColumnNames
     * @return a new DataSet
     */
    DataSet fullJoin(DataSet right, Map onColumnNames);

    /**
     * Returns a new DataSet that has all the rows from this DataSet and the specified right DataSet, regardless of whether there are any matches.
     *
     * @param right
     * @param onColumnNames
     * @param newColumnName
     * @param newColumnClass it can be Object[]/List/List/Set/Map/Entity
     * @return a new DataSet
     */
    DataSet fullJoin(DataSet right, Map onColumnNames, String newColumnName, Class newColumnClass);

    /**
     * Returns a new DataSet that has all the rows from this DataSet and the specified right DataSet, regardless of whether there are any matches.
     *
     * @param right
     * @param onColumnNames
     * @param newColumnName
     * @param newColumnClass it can be Object[]/List/List/Set/Map/Entity
     * @param collClass it's for one-to-many join
     * @return a new DataSet
     */
    @SuppressWarnings("rawtypes")
    DataSet fullJoin(DataSet right, Map onColumnNames, String newColumnName, Class newColumnClass, Class collClass);

    /**
     * Returns a new DataSet. Duplicated row in the specified {@code DataSet} will be eliminated.
     *
     * @param dataSet
     * @return a new DataSet
     */
    DataSet union(DataSet dataSet);

    /**
     * Returns a new DataSet. Duplicated row in the specified {@code DataSet} will not be eliminated.
     *
     * @param dataSet
     * @return a new DataSet
     */
    DataSet unionAll(DataSet dataSet);

    /**
     * Returns a new DataSet.
     *
     * @param dataSet
     * @return a new DataSet
     * @see com.landawn.abacus.util.IntList#intersection(com.landawn.abacus.util.IntList)
     */
    DataSet intersection(DataSet dataSet);

    /**
     * Returns a new DataSet.
     *
     * @param dataSet
     * @return a new DataSet
     * @see com.landawn.abacus.util.IntList#difference(com.landawn.abacus.util.IntList)
     */
    DataSet difference(DataSet dataSet);

    /**
     * 
     * @param dataSet
     * @return
     * @see com.landawn.abacus.util.IntList#symmetricDifference(com.landawn.abacus.util.IntList)
     */
    DataSet symmetricDifference(DataSet dataSet);

    /**
     * 
     * @param dataSet
     * @return
     * @see java.util.Collection#retainAll(Collection)
     */
    DataSet retainAll(DataSet dataSet);

    /**
     * 
     * @param dataSet
     * @return
     * @see java.util.Collection#removeAll(Collection)
     */
    DataSet removeAll(DataSet dataSet);

    /**
     * Returns a new DataSet by appending the specified from DataSet into this DataSet.
     *
     * @param from
     */
    DataSet merge(DataSet from);

    /**
     * Returns a new DataSet by appending the specified from DataSet into this DataSet.
     *
     * @param from
     * @param columnNames
     */
    DataSet merge(DataSet from, Collection columnNames);

    /**
     * Returns a new DataSet by appending the specified from DataSet from fromRowIndex to toRowIndex into this DataSet.
     *
     * @param from
     * @param fromRowIndex
     * @param toRowIndex
     */
    DataSet merge(DataSet from, int fromRowIndex, int toRowIndex);

    /**
     * Returns a new DataSet by appending the specified columnNames in from DataSet from fromRowIndex to toRowIndex into this DataSet.
     *
     * @param from
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     */
    DataSet merge(DataSet from, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param size
     * @return
     */
    List split(int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param size
     * @param columnNames
     * @return
     */
    List split(Collection columnNames, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param fromRowIndex
     * @param toRowIndex
     * @param size
     * @return
     */
    List split(int fromRowIndex, int toRowIndex, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param size
     * @return
     */
    List split(Collection columnNames, int fromRowIndex, int toRowIndex, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param size
     * @return
     */
     List> split(Class rowClass, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param size
     * @param columnNames
     * @return
     */
     List> split(Class rowClass, Collection columnNames, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @param size
     * @return
     */
     List> split(Class rowClass, int fromRowIndex, int toRowIndex, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param size
     * @return
     */
     List> split(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param size
     * @return
     */
     List> split(IntFunction rowSupplier, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param size
     * @param columnNames
     * @return
     */
     List> split(IntFunction rowSupplier, Collection columnNames, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @param size
     * @return
     */
     List> split(IntFunction rowSupplier, int fromRowIndex, int toRowIndex, int size);

    /**
     * Returns consecutive sub lists of this DataSet, each of the same size (the list may be smaller), or an empty List if this DataSet is empty.
     * 
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @param size
     * @return
     */
     List> split(IntFunction rowSupplier, Collection columnNames, int fromRowIndex, int toRowIndex, int size);

    ImmutableIterator iterator();

    /**
     * Method paginate.
     *
     * @param pageSize
     * @return
     */
    PaginatedDataSet paginate(int pageSize);

    //    /**
    //     * Returns the elements at: 0.01%, 0.1%, 1%, 10%, 20%, 30%, 50%, 70%, 80%, 90%, 99%, 99.9%, 99.99% * length of the specified column after it's sorted.
    //     * The the value of column must implements the Comparable interface.
    //     * 
    //     * @param columnName
    //     * @return
    //     */
    //    > Map percentiles(String columnName);
    //
    //    /**
    //     * Returns the elements at: 0.01%, 0.1%, 1%, 10%, 20%, 30%, 50%, 70%, 80%, 90%, 99%, 99.9%, 99.99% * length of the specified column after it's sorted.
    //     * 
    //     * @param columnName
    //     * @param comparator
    //     * @return
    //     */
    //     Map percentiles(String columnName, Comparator comparator);

    /**
     * 
     * @param columnName
     * @return
     */
     Stream stream(String columnName);

    /**
     * 
     * @param columnName
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Stream stream(String columnName, int fromRowIndex, int toRowIndex);

    /**
     *
     * @return
     */
    Stream stream();

    /**
     *
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    Stream stream(int fromRowIndex, int toRowIndex);

    /**
     * 
     * @param columnNames
     * @return
     */
    Stream stream(Collection columnNames);

    /**
     * 
     * @param columnNames
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
    Stream stream(Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @return
     */
     Stream stream(Class rowClass);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Stream stream(Class rowClass, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Stream stream(Class rowClass, Collection columnNames);

    /**
     *
     * @param rowClass it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Stream stream(Class rowClass, Collection columnNames, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @return
     */
     Stream stream(IntFunction rowSupplier);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Stream stream(IntFunction rowSupplier, int fromRowIndex, int toRowIndex);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Stream stream(IntFunction rowSupplier, Collection columnNames);

    /**
     *
     * @param rowSupplier it can be Object[]/List/List/Set/Map/Entity
     * @param fromRowIndex
     * @param toRowIndex
     * @return
     */
     Stream stream(IntFunction rowSupplier, Collection columnNames, int fromRowIndex, int toRowIndex);

     R apply(Try.Function func) throws E;

     void accept(Try.Consumer action) throws E;

    /**
     * Method freeze
     */
    void freeze();

    /**
     * Method frozen
     *
     * @return
     */
    boolean frozen();

    /**
     * Method clear.
     */
    void clear();

    /**
     *
     * @return
     */
    boolean isEmpty();

    /**
     * 
     */
    void trimToSize();

    /**
     * Returns the size of this {@code DataSet}.
     *
     * @return
     */
    int size();

    /**
     *
     * @return
     */
    Properties properties();

    //    /**
    //     *
    //     * @param propName
    //     * @return
    //     */
    //     T getProperty(String propName);
    //
    //    /**
    //     * Returns the old value associated with the property by the {@code propName}, {@code null} if it doesn't exist.
    //     *
    //     * @param propName
    //     * @param propValue
    //     * @return
    //     */
    //     T setProperty(String propName, Object propValue);
    //
    //    /**
    //     * Returns value of the property which is to be removed, {@code null} if it doesn't exist.
    //     *
    //     * @param propName
    //     * @return
    //     */
    //     T removeProperty(String propName);

     Sheet toSheet();

    /**
     * it's same as: N.println(toString());
     */
    void println();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy