Home | History | Annotate | Download | only in collect

Lines Matching refs:table

25 import com.google.common.collect.Table.Cell;
45 ArrayTable<String, Integer, Character> table =
47 populate(table, data);
48 return table;
52 assertEquals(9, table.size());
66 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
67 assertTrue(table.contains("foo", 1));
68 assertTrue(table.contains("bar", 1));
69 assertTrue(table.contains("foo", 3));
70 assertTrue(table.contains("foo", 2));
71 assertTrue(table.contains("bar", 3));
72 assertTrue(table.contains("cat", 1));
73 assertFalse(table.contains("foo", -1));
74 assertFalse(table.contains("bad", 1));
75 assertFalse(table.contains("bad", -1));
76 assertFalse(table.contains("foo", null));
77 assertFalse(table.contains(null, 1));
78 assertFalse(table.contains(null, null));
82 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
83 assertTrue(table.containsRow("foo"));
84 assertTrue(table.containsRow("bar"));
85 assertTrue(table.containsRow("cat"));
86 assertFalse(table.containsRow("bad"));
87 assertFalse(table.containsRow(null));
91 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
92 assertTrue(table.containsColumn(1));
93 assertTrue(table.containsColumn(3));
94 assertTrue(table.containsColumn(2));
95 assertFalse(table.containsColumn(-1));
96 assertFalse(table.containsColumn(null));
100 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
101 assertTrue(table.containsValue('a'));
102 assertTrue(table.containsValue('b'));
103 assertTrue(table.containsValue('c'));
104 assertFalse(table.containsValue('x'));
105 assertTrue(table.containsValue(null));
109 assertFalse(table.isEmpty());
110 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
111 assertFalse(table.isEmpty());
115 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
116 Table<String, Integer, Character> hashCopy = HashBasedTable.create();
120 Table<String, Integer, Character> reordered
122 Table<String, Integer, Character> smaller
124 Table<String, Integer, Character> swapOuter
126 Table<String, Integer, Character> swapValues
130 .addEqualityGroup(table, reordered)
139 table = ArrayTable.create(asList("foo", "bar"), asList(1, 3));
140 table.put("foo", 1, 'a');
141 table.put("bar", 1, 'b');
142 table.put("foo", 3, 'c');
147 assertEquals(expected, table.hashCode());
151 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
156 assertEquals(expected, table.row("foo"));
160 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
165 assertEquals(expected, table.column(1));
169 table = ArrayTable.create(ImmutableList.of("foo"), ImmutableList.of(1));
170 table.put("foo", 1, 'a');
171 assertEquals("{foo={1=a}}", table.toString());
203 Table<String, Integer, Character> original
205 Table<String, Integer, Character> copy = ArrayTable.create(original);
215 Table<String, Integer, Character> original = HashBasedTable.create();
219 Table<String, Integer, Character> copy = ArrayTable.create(original);
233 Table<String, Integer, Character> original = HashBasedTable.create();
241 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
242 SerializableTester.reserializeAndAssert(table);
251 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
255 table.toString());
259 table.rowMap().toString());
263 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
267 table.cellSet().toString());
271 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
272 assertEquals("[foo, bar, cat]", table.rowKeySet().toString());
276 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
277 assertEquals("[1, 2, 3]", table.columnKeySet().toString());
281 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
283 table.values().toString());
287 ArrayTable<String, Integer, Character> table
289 assertThat(table.rowKeyList()).has().exactly("foo", "bar", "cat").inOrder();
293 ArrayTable<String, Integer, Character> table
295 assertThat(table.columnKeyList()).has().exactly(1, 2, 3).inOrder();
299 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
300 assertNull(table.get("dog", 1));
301 assertNull(table.get("foo", 4));
305 ArrayTable<String, Integer, Character> table
307 assertEquals((Character) 'b', table.at(1, 0));
308 assertEquals((Character) 'c', table.at(0, 2));
309 assertNull(table.at(1, 2));
311 table.at(1, 3);
315 table.at(1, -1);
319 table.at(3, 2);
323 table.at(-1, 2);
329 ArrayTable<String, Integer, Character> table
331 assertEquals((Character) 'b', table.set(1, 0, 'd'));
332 assertEquals((Character) 'd', table.get("bar", 1));
333 assertNull(table.set(2, 0, 'e'));
334 assertEquals((Character) 'e', table.get("cat", 1));
335 assertEquals((Character) 'a', table.set(0, 0, null));
336 assertNull(table.get("foo", 1));
338 table.set(1, 3, 'z');
342 table.set(1, -1, 'z');
346 table.set(3, 2, 'z');
350 table.set(-1, 2, 'z');
353 assertFalse(table.containsValue('z'));
357 ArrayTable<String, Integer, Character> table
359 table.eraseAll();
360 assertEquals(9, table.size());
361 assertNull(table.get("bar", 1));
362 assertTrue(table.containsRow("foo"));
363 assertFalse(table.containsValue('a'));
367 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
369 table.put("dog", 1, 'd');
375 table.put("foo", 4, 'd');
380 assertFalse(table.containsValue('d'));
384 ArrayTable<String, Integer, Character> table
386 assertEquals((Character) 'b', table.erase("bar", 1));
387 assertNull(table.get("bar", 1));
388 assertEquals(9, table.size());
389 assertNull(table.erase("bar", 1));
390 assertNull(table.erase("foo", 2));
391 assertNull(table.erase("dog", 1));
392 assertNull(table.erase("bar", 5));
393 assertNull(table.erase(null, 1));
394 assertNull(table.erase("bar", null));
399 ArrayTable<String, Integer, Character> table
401 Character[][] array = table.toArray(Character.class);
406 table.set(0, 2, 'd');
409 assertEquals((Character) 'd', table.at(0, 2));
413 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
414 Cell<String, Integer, Character> cell = table.cellSet().iterator().next();
416 assertEquals((Character) 'a', table.put("foo", 1, 'd'));
421 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
422 Map<Integer, Character> row = table.row("dog");
431 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
432 Map<String, Character> column = table.column(4);
441 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
442 Map<Integer, Character> map = table.row("foo");
452 table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
453 Map<String, Character> map = table.column(3);