Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import com.google.common.collect.Table.Cell;
import com.google.common.testing.CollectorTester;
import java.util.function.BiPredicate;
import java.util.function.BinaryOperator;
import java.util.stream.Collector;
import java.util.stream.Stream;
import junit.framework.TestCase;
import org.checkerframework.checker.nullness.qual.Nullable;

/** Unit tests for {@link TableCollectors}. */
@GwtCompatible(emulated = true)
Expand Down Expand Up @@ -191,12 +193,15 @@ public void testToTable() {
}

public void testToTableNullMerge() {
// TODO github.com/google/guava/issues/6824 - the null merge feature is not compatible with the
// current nullness annotation of the mergeFunction parameter. Work around with casts.
BinaryOperator<@Nullable Integer> mergeFunction = (v1, v2) -> null;
Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector =
TableCollectors.toTable(
Cell::getRowKey,
Cell::getColumnKey,
Cell::getValue,
(Integer v1, Integer v2) -> null,
(BinaryOperator<Integer>) mergeFunction,
HashBasedTable::create);
BiPredicate<Table<String, String, Integer>, Table<String, String, Integer>> equivalence =
pairwiseOnResultOf(Table::cellSet);
Expand Down