MCPcopy Create free account
hub / github.com/antlr/codebuff / ArrayTable

Method ArrayTable

corpus/java/training/guava/collect/ArrayTable.java:147–166  ·  view source on GitHub ↗
(Iterable<? extends R> rowKeys, Iterable<? extends C> columnKeys)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

copyOfMethod · 0.95
indexMapMethod · 0.95
eraseAllMethod · 0.95
putAllMethod · 0.95
isEmptyMethod · 0.65
sizeMethod · 0.65
rowKeySetMethod · 0.65
columnKeySetMethod · 0.65
checkArgumentMethod · 0.45

Tested by

no test coverage detected