本文整理了Java中com.google.common.collect.Table.rowKeySet()
方法的一些代码示例,展示了Table.rowKeySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.rowKeySet()
方法的具体详情如下:
包路径:com.google.common.collect.Table
类名称:Table
方法名:rowKeySet
[英]Returns a set of row keys that have one or more values in the table. Changes to the set will update the underlying table, and vice versa.
[中]返回一组在表中有一个或多个值的行键。对集合的更改将更新基础表,反之亦然。
代码示例来源:origin: google/guava
@Override
public Set<R> rowKeySet() {
return fromTable.rowKeySet();
}
代码示例来源:origin: google/guava
@Override
public Set<R> columnKeySet() {
return original.rowKeySet();
}
代码示例来源:origin: google/guava
@Override
public Set<R> rowKeySet() {
return delegate().rowKeySet();
}
代码示例来源:origin: google/guava
@Override
public Set<R> rowKeySet() {
assertTrue(Thread.holdsLock(mutex));
return delegate.rowKeySet();
}
代码示例来源:origin: google/guava
@Override
public Set<R> rowKeySet() {
synchronized (mutex) {
return set(delegate().rowKeySet(), mutex);
}
}
代码示例来源:origin: google/guava
private ArrayTable(Table<R, C, V> table) {
this(table.rowKeySet(), table.columnKeySet());
putAll(table);
}
代码示例来源:origin: google/guava
@Override
protected Set<String> create(String[] elements) {
Table<String, Integer, Character> table = HashBasedTable.create();
populateForRowKeySet(table, elements);
return table.rowKeySet();
}
})
代码示例来源:origin: google/guava
@Override
protected Set<String> create(String[] elements) {
Table<String, Integer, Character> table =
ArrayTable.create(ImmutableList.copyOf(elements), ImmutableList.of(1, 2));
populateForRowKeySet(table, elements);
return table.rowKeySet();
}
})
代码示例来源:origin: google/guava
public void testRowKeySetToString_ordered() {
table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
assertEquals("[foo, bar, cat]", table.rowKeySet().toString());
}
代码示例来源:origin: google/guava
public void testRowKeySetToString_ordered() {
table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
assertEquals("[bar, foo]", table.rowKeySet().toString());
}
代码示例来源:origin: google/guava
@Override
protected Set<String> create(String[] elements) {
Table<String, Integer, Character> table = HashBasedTable.create();
populateForRowKeySet(table, elements);
return Tables.unmodifiableTable(table).rowKeySet();
}
})
代码示例来源:origin: google/guava
public void testCreateExplicitComparators() {
table = TreeBasedTable.create(Collections.reverseOrder(), Ordering.usingToString());
table.put("foo", 3, 'a');
table.put("foo", 12, 'b');
table.put("bar", 5, 'c');
table.put("cat", 8, 'd');
assertThat(table.rowKeySet()).containsExactly("foo", "cat", "bar").inOrder();
assertThat(table.row("foo").keySet()).containsExactly(12, 3).inOrder();
}
代码示例来源:origin: google/guava
public void testRowKeySetOrdering() {
table = create("foo", 3, 'a', "bar", 1, 'b', "foo", 2, 'c');
assertThat(table.rowKeySet()).containsExactly("foo", "bar").inOrder();
}
代码示例来源:origin: google/guava
public void testCreateCopyArrayTable() {
Table<String, Integer, Character> original =
create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
Table<String, Integer, Character> copy = ArrayTable.create(original);
assertEquals(original, copy);
original.put("foo", 1, 'd');
assertEquals((Character) 'd', original.get("foo", 1));
assertEquals((Character) 'a', copy.get("foo", 1));
assertEquals(copy.rowKeySet(), original.rowKeySet());
assertEquals(copy.columnKeySet(), original.columnKeySet());
}
代码示例来源:origin: google/guava
private static <R, C, V> void validateViewOrdering(Table<R, C, V> original, Table<R, C, V> copy) {
assertThat(copy.cellSet()).containsExactlyElementsIn(original.cellSet()).inOrder();
assertThat(copy.rowKeySet()).containsExactlyElementsIn(original.rowKeySet()).inOrder();
assertThat(copy.values()).containsExactlyElementsIn(original.values()).inOrder();
}
代码示例来源:origin: google/guava
private static <R, C, V> void validateReserialization(Table<R, C, V> original) {
Table<R, C, V> copy = SerializableTester.reserializeAndAssert(original);
assertThat(copy.cellSet()).containsExactlyElementsIn(original.cellSet()).inOrder();
assertThat(copy.rowKeySet()).containsExactlyElementsIn(original.rowKeySet()).inOrder();
assertThat(copy.columnKeySet()).containsExactlyElementsIn(original.columnKeySet()).inOrder();
}
代码示例来源:origin: google/guava
public void testIterationOrder() {
Table<String, String, String> table = HashBasedTable.create();
for (int i = 0; i < 5; i++) {
table.put("r" + i, "c" + i, "v" + i);
}
assertThat(table.rowKeySet()).containsExactly("r0", "r1", "r2", "r3", "r4").inOrder();
assertThat(table.columnKeySet()).containsExactly("c0", "c1", "c2", "c3", "c4").inOrder();
assertThat(table.values()).containsExactly("v0", "v1", "v2", "v3", "v4").inOrder();
}
代码示例来源:origin: google/guava
public void testCreateCopy() {
TreeBasedTable<String, Integer, Character> original =
TreeBasedTable.create(Collections.reverseOrder(), Ordering.usingToString());
original.put("foo", 3, 'a');
original.put("foo", 12, 'b');
original.put("bar", 5, 'c');
original.put("cat", 8, 'd');
table = TreeBasedTable.create(original);
assertThat(table.rowKeySet()).containsExactly("foo", "cat", "bar").inOrder();
assertThat(table.row("foo").keySet()).containsExactly(12, 3).inOrder();
assertEquals(original, table);
}
代码示例来源:origin: google/guava
public void testBuilder_orderRowsBy_dense() {
ImmutableTable.Builder<Character, Integer, String> builder = ImmutableTable.builder();
builder.orderRowsBy(Ordering.natural());
builder.put('c', 3, "foo");
builder.put('c', 2, "bar");
builder.put('c', 1, "baz");
builder.put('b', 3, "cat");
builder.put('b', 1, "dog");
builder.put('a', 3, "foo");
builder.put('a', 2, "bar");
builder.put('a', 1, "baz");
Table<Character, Integer, String> table = builder.build();
assertThat(table.rowKeySet()).containsExactly('a', 'b', 'c').inOrder();
assertThat(table.column(1).keySet()).containsExactly('a', 'b', 'c').inOrder();
}
代码示例来源:origin: google/guava
public void testTransposedViews() {
Table<Integer, String, Character> original = HashBasedTable.create();
Table<String, Integer, Character> transpose = Tables.transpose(original);
original.put(1, "foo", 'a');
assertSame(original.columnKeySet(), transpose.rowKeySet());
assertSame(original.rowKeySet(), transpose.columnKeySet());
assertSame(original.columnMap(), transpose.rowMap());
assertSame(original.rowMap(), transpose.columnMap());
assertSame(original.values(), transpose.values());
assertEquals(original.row(1), transpose.column(1));
assertEquals(original.row(2), transpose.column(2));
assertEquals(original.column("foo"), transpose.row("foo"));
assertEquals(original.column("bar"), transpose.row("bar"));
}
}
内容来源于网络,如有侵权,请联系作者删除!