com.google.common.collect.Table.size()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(394)

本文整理了Java中com.google.common.collect.Table.size()方法的一些代码示例,展示了Table.size()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.size()方法的具体详情如下:
包路径:com.google.common.collect.Table
类名称:Table
方法名:size

Table.size介绍

[英]Returns the number of row key / column key / value mappings in the table.
[中]返回表中的行键/列键/值映射数。

代码示例

代码示例来源:origin: google/guava

  1. @Override
  2. public int size() {
  3. return fromTable.size();
  4. }

代码示例来源:origin: google/guava

  1. @Override
  2. public int size() {
  3. return original.size();
  4. }

代码示例来源:origin: google/j2objc

  1. @Override
  2. public int size() {
  3. return fromTable.size();
  4. }

代码示例来源:origin: google/j2objc

  1. @Override
  2. public int size() {
  3. synchronized (mutex) {
  4. return delegate().size();
  5. }
  6. }

代码示例来源:origin: google/j2objc

  1. @Override
  2. public int size() {
  3. return original.size();
  4. }

代码示例来源:origin: guoguibing/librec

  1. /**
  2. * @return
  3. */
  4. public int size() {
  5. size = table.size();
  6. return size;
  7. }

代码示例来源:origin: wildfly/wildfly

  1. @Override
  2. public int size() {
  3. return fromTable.size();
  4. }

代码示例来源:origin: google/guava

  1. @Override
  2. public int size() {
  3. return delegate().size();
  4. }

代码示例来源:origin: google/guava

  1. @Override
  2. public int size() {
  3. synchronized (mutex) {
  4. return delegate().size();
  5. }
  6. }

代码示例来源:origin: google/j2objc

  1. @Override
  2. public int size() {
  3. return delegate().size();
  4. }

代码示例来源:origin: google/guava

  1. @Override
  2. public int size() {
  3. assertTrue(Thread.holdsLock(mutex));
  4. return delegate.size();
  5. }

代码示例来源:origin: guoguibing/librec

  1. public RowSequentialAccessSparseMatrix(int rows,
  2. int columns,
  3. Table<Integer, Integer, ? extends Number> dataTable) {
  4. this(rows, columns);
  5. numEntries = dataTable.size();
  6. construct(dataTable, false);
  7. }

代码示例来源:origin: wildfly/wildfly

  1. @Override
  2. public int size() {
  3. synchronized (mutex) {
  4. return delegate().size();
  5. }
  6. }

代码示例来源:origin: guoguibing/librec

  1. public RowSequentialAccessSparseMatrix(int rows,
  2. int columns,
  3. Table<Integer, Integer, ? extends Number> dataTable,
  4. boolean transpose) {
  5. this(rows, columns);
  6. numEntries = dataTable.size();
  7. construct(dataTable, transpose);
  8. }

代码示例来源:origin: wildfly/wildfly

  1. @Override
  2. public int size() {
  3. return delegate().size();
  4. }

代码示例来源:origin: google/guava

  1. @Override
  2. protected void assertSize(int expectedSize) {
  3. assertEquals(9, table.size());
  4. }

代码示例来源:origin: google/guava

  1. protected void assertSize(int expectedSize) {
  2. assertEquals(expectedSize, table.size());
  3. }

代码示例来源:origin: google/guava

  1. public void testCreateCopyHashBasedTable() {
  2. Table<String, Integer, Character> original = HashBasedTable.create();
  3. original.put("foo", 1, 'a');
  4. original.put("bar", 1, 'b');
  5. original.put("foo", 3, 'c');
  6. Table<String, Integer, Character> copy = ArrayTable.create(original);
  7. assertEquals(4, copy.size());
  8. assertEquals((Character) 'a', copy.get("foo", 1));
  9. assertEquals((Character) 'b', copy.get("bar", 1));
  10. assertEquals((Character) 'c', copy.get("foo", 3));
  11. assertNull(copy.get("bar", 3));
  12. original.put("foo", 1, 'd');
  13. assertEquals((Character) 'd', original.get("foo", 1));
  14. assertEquals((Character) 'a', copy.get("foo", 1));
  15. assertEquals(copy.rowKeySet(), ImmutableSet.of("foo", "bar"));
  16. assertEquals(copy.columnKeySet(), ImmutableSet.of(1, 3));
  17. }

代码示例来源:origin: google/guava

  1. public void testClear() {
  2. table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
  3. if (supportsRemove()) {
  4. table.clear();
  5. assertEquals(0, table.size());
  6. assertFalse(table.containsRow("foo"));
  7. } else {
  8. try {
  9. table.clear();
  10. fail();
  11. } catch (UnsupportedOperationException expected) {
  12. }
  13. }
  14. }

代码示例来源:origin: google/guava

  1. public void testRemove() {
  2. table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
  3. if (supportsRemove()) {
  4. assertNull(table.remove("cat", 1));
  5. assertNull(table.remove("bar", 3));
  6. assertEquals(3, table.size());
  7. assertEquals((Character) 'c', table.remove("foo", 3));
  8. assertEquals(2, table.size());
  9. assertEquals((Character) 'a', table.get("foo", 1));
  10. assertEquals((Character) 'b', table.get("bar", 1));
  11. assertNull(table.get("foo", 3));
  12. assertNull(table.remove(null, 1));
  13. assertNull(table.remove("foo", null));
  14. assertNull(table.remove(null, null));
  15. assertSize(2);
  16. } else {
  17. try {
  18. table.remove("foo", 3);
  19. fail();
  20. } catch (UnsupportedOperationException expected) {
  21. }
  22. assertEquals((Character) 'c', table.get("foo", 3));
  23. }
  24. }

相关文章