Java Code Examples for com.google.common.collect.Table#column()
The following examples show how to use
com.google.common.collect.Table#column() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiscretizationUtil.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 6 votes |
static private Map<String, RowFilter> parseInlineTable(InlineTable inlineTable){ Map<String, RowFilter> result = new LinkedHashMap<>(); Table<Integer, String, Object> table = InlineTableUtil.getContent(inlineTable); Set<String> columns = table.columnKeySet(); for(String column : columns){ Map<Integer, Object> columnValues = table.column(column); RowFilter rowFilter = new RowFilter(columnValues); result.put(column, rowFilter); } return result; }
Example 2
Source File: BrowserTest.java From kurento-java with Apache License 2.0 | 5 votes |
private void shiftTable(Table<Integer, Integer, String> table, int columnKey) { for (int i = table.columnKeySet().size() - 1; i >= columnKey; i--) { Map<Integer, String> column = table.column(i); for (int j : column.keySet()) { table.put(j, i + 1, column.get(j)); } } table.column(columnKey).clear(); }
Example 3
Source File: GuavaTableUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void givenTable_whenColumn_returnsSuccessfully() { final Table<String, String, Integer> universityCourseSeatTable = HashBasedTable.create(); universityCourseSeatTable.put("Mumbai", "Chemical", 120); universityCourseSeatTable.put("Mumbai", "IT", 60); universityCourseSeatTable.put("Harvard", "Electrical", 60); universityCourseSeatTable.put("Harvard", "IT", 120); final Map<String, Integer> universitySeatMap = universityCourseSeatTable.column("IT"); assertThat(universitySeatMap).hasSize(2); assertThat(universitySeatMap.get("Mumbai")).isEqualTo(60); assertThat(universitySeatMap.get("Harvard")).isEqualTo(120); }