static <R, C, V> RegularImmutableTable<R, C, V> forCells(Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells(Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells(Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
Collections.sort(cells, comparator); return forCellsInternal(cells, rowComparator, columnComparator);
Collections.sort(cells, comparator); return forCellsInternal(cells, rowComparator, columnComparator);
Collections.sort(cells, comparator); return forCellsInternal(cells, rowComparator, columnComparator);
static <R, C, V> RegularImmutableTable<R, C, V> forCells( Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells( Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells( Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells( Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells( Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static final <R, C, V> RegularImmutableTable<R, C, V> forCells( Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells( Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static final <R, C, V> RegularImmutableTable<R, C, V> forCells( Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells(Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells(Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells(Iterable<Cell<R, C, V>> cells) { return forCellsInternal(cells, null, null); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells( List<Cell<R, C, V>> cells, @Nullable final Comparator<? super R> rowComparator, @Nullable final Comparator<? super C> columnComparator) { checkNotNull(cells); if (rowComparator != null || columnComparator != null) { /* * This sorting logic leads to a cellSet() ordering that may not be expected and that isn't * documented in the Javadoc. If a row Comparator is provided, cellSet() iterates across the * columns in the first row, the columns in the second row, etc. If a column Comparator is * provided but a row Comparator isn't, cellSet() iterates across the rows in the first * column, the rows in the second column, etc. */ Comparator<Cell<R, C, V>> comparator = new Comparator<Cell<R, C, V>>() { @Override public int compare(Cell<R, C, V> cell1, Cell<R, C, V> cell2) { int rowCompare = (rowComparator == null) ? 0 : rowComparator.compare(cell1.getRowKey(), cell2.getRowKey()); if (rowCompare != 0) { return rowCompare; } return (columnComparator == null) ? 0 : columnComparator.compare(cell1.getColumnKey(), cell2.getColumnKey()); } }; Collections.sort(cells, comparator); } return forCellsInternal(cells, rowComparator, columnComparator); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells( List<Cell<R, C, V>> cells, @Nullable final Comparator<? super R> rowComparator, @Nullable final Comparator<? super C> columnComparator) { checkNotNull(cells); if (rowComparator != null || columnComparator != null) { /* * This sorting logic leads to a cellSet() ordering that may not be expected and that isn't * documented in the Javadoc. If a row Comparator is provided, cellSet() iterates across the * columns in the first row, the columns in the second row, etc. If a column Comparator is * provided but a row Comparator isn't, cellSet() iterates across the rows in the first * column, the rows in the second column, etc. */ Comparator<Cell<R, C, V>> comparator = new Comparator<Cell<R, C, V>>() { @Override public int compare(Cell<R, C, V> cell1, Cell<R, C, V> cell2) { int rowCompare = (rowComparator == null) ? 0 : rowComparator.compare(cell1.getRowKey(), cell2.getRowKey()); if (rowCompare != 0) { return rowCompare; } return (columnComparator == null) ? 0 : columnComparator.compare(cell1.getColumnKey(), cell2.getColumnKey()); } }; Collections.sort(cells, comparator); } return forCellsInternal(cells, rowComparator, columnComparator); }
static <R, C, V> RegularImmutableTable<R, C, V> forCells( List<Cell<R, C, V>> cells, @Nullable final Comparator<? super R> rowComparator, @Nullable final Comparator<? super C> columnComparator) { checkNotNull(cells); if (rowComparator != null || columnComparator != null) { /* * This sorting logic leads to a cellSet() ordering that may not be expected and that isn't * documented in the Javadoc. If a row Comparator is provided, cellSet() iterates across the * columns in the first row, the columns in the second row, etc. If a column Comparator is * provided but a row Comparator isn't, cellSet() iterates across the rows in the first * column, the rows in the second column, etc. */ Comparator<Cell<R, C, V>> comparator = new Comparator<Cell<R, C, V>>() { @Override public int compare(Cell<R, C, V> cell1, Cell<R, C, V> cell2) { int rowCompare = (rowComparator == null) ? 0 : rowComparator.compare(cell1.getRowKey(), cell2.getRowKey()); if (rowCompare != 0) { return rowCompare; } return (columnComparator == null) ? 0 : columnComparator.compare(cell1.getColumnKey(), cell2.getColumnKey()); } }; Collections.sort(cells, comparator); } return forCellsInternal(cells, rowComparator, columnComparator); }