/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<>(Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells(cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<>(Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells(cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<>(Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells(cells, rowComparator, columnComparator); } } }
public void testForCells() { assertTrue(RegularImmutableTable.forCells(CELLS) instanceof DenseImmutableTable<?, ?, ?>); assertTrue( RegularImmutableTable.forCells( ImmutableSet.of( Tables.immutableCell('a', 1, "blah"), Tables.immutableCell('b', 2, "blah"), Tables.immutableCell('c', 3, "blah"))) instanceof SparseImmutableTable<?, ?, ?>); }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<R, C, V>( Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells( cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<R, C, V>( Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells( cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<R, C, V>( Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells( cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<R, C, V>(Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells(cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<>(Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells(cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<>(Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells(cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<R, C, V>( Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells( cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<R, C, V>( Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells( cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<R, C, V>( Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells( cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<R, C, V>( Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells( cells, rowComparator, columnComparator); } } }
/** * Returns a newly-created immutable table. * * @throws IllegalArgumentException if duplicate key pairs were added */ public ImmutableTable<R, C, V> build() { int size = cells.size(); switch (size) { case 0: return of(); case 1: return new SingletonImmutableTable<R, C, V>( Iterables.getOnlyElement(cells)); default: return RegularImmutableTable.forCells( cells, rowComparator, columnComparator); } } }
public void testForCells() { assertTrue(RegularImmutableTable.forCells(CELLS) instanceof DenseImmutableTable<?, ?, ?>); assertTrue(RegularImmutableTable.forCells(ImmutableSet.of( Tables.immutableCell('a', 1, "blah"), Tables.immutableCell('b', 2, "blah"), Tables.immutableCell('c', 3, "blah"))) instanceof SparseImmutableTable<?, ?, ?>); }
(C) cell.getColumnKey(), (V) cell.getValue())); return RegularImmutableTable.forCells(cellSetBuilder.build());
(C) cell.getColumnKey(), (V) cell.getValue())); return RegularImmutableTable.forCells(cellSetBuilder.build());
(C) cell.getColumnKey(), (V) cell.getValue())); return RegularImmutableTable.forCells(cellSetBuilder.build());
cellOf((R) cell.getRowKey(), (C) cell.getColumnKey(), (V) cell.getValue())); return RegularImmutableTable.forCells(cellSetBuilder.build());