Java Code Examples for io.vavr.collection.Seq#length()

The following examples show how to use io.vavr.collection.Seq#length() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataTable.java    From java-datatable with Apache License 2.0 2 votes vote down vote up
/**
 * Validates there are no duplicate columns names.
 *
 * @param columns The columns to check.
 * @return Returns a Success or Failure.
 */
private static Try<Seq<IDataColumn>> validateColumnNames(Seq<IDataColumn> columns) {
    return columns.groupBy(IDataColumn::name).length() != columns.length()
            ? DataTableException.tryError("Columns contain duplicate names.")
            : Try.success(columns);
}
 
Example 2
Source File: DataRowCollectionModifiable.java    From java-datatable with Apache License 2.0 2 votes vote down vote up
/**
 * Validates the number of values equals the number of columns in the table.
 *
 * @param values The values.
 * @return Returns a sequence of ColumnValuePairs if valid.
 */
private Try<Seq<ColumnValuePair>> mapValuesToColumns(Seq<Object> values) {
    return values.length() != table.columns().count()
            ? DataTableException.tryError("Number of values does not match number of columns.")
            : Try.success(createIndexedColumnValuePair(values));
}