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

Method ArrayTable

output/java_guava/1.4.16/ArrayTable.java:149–167  ·  view source on GitHub ↗
(Iterable<? extends R> rowKeys, Iterable<? extends C> columnKeys)

Source from the content-addressed store, hash-verified

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());

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