(Iterable<? extends R> rowKeys, Iterable<? extends C> columnKeys)
| 147 | private final ImmutableMap<C, Integer> columnKeyToIndex; |
| 148 | private final V[][] array; |
| 149 | private ArrayTable(Iterable<? extends R> rowKeys, Iterable<? extends C> columnKeys) { |
| 150 | this.rowList = ImmutableList.copyOf(rowKeys); |
| 151 | this.columnList = ImmutableList.copyOf(columnKeys); |
| 152 | checkArgument(!rowList.isEmpty()); |
| 153 | checkArgument(!columnList.isEmpty()); |
| 154 | |
| 155 | /* |
| 156 | * TODO(jlevy): Support empty rowKeys or columnKeys? If we do, when |
| 157 | * columnKeys is empty but rowKeys isn't, the table is empty but |
| 158 | * containsRow() can return true and rowKeySet() isn't empty. |
| 159 | */ |
| 160 | rowKeyToIndex = Maps.indexMap(rowList); |
| 161 | columnKeyToIndex = Maps.indexMap(columnList); |
| 162 | @SuppressWarnings("unchecked") |
| 163 | V[][] tmpArray = (V[][]) new Object[rowList.size()][columnList.size()]; |
| 164 | array = tmpArray; |
| 165 | // Necessary because in GWT the arrays are initialized with "undefined" instead of null. |
| 166 | eraseAll(); |
| 167 | } |
| 168 | |
| 169 | private ArrayTable(Table<R, C, V> table) { |
| 170 | this(table.rowKeySet(), table.columnKeySet()); |
nothing calls this directly
no test coverage detected