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

Class CellIterator

output/java_guava/1.4.19/StandardTable.java:244–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242 }
243
244 private class CellIterator implements Iterator<Cell<R, C, V>> {
245 final Iterator<Entry<R, Map<C, V>>> rowIterator = backingMap.entrySet().iterator();
246
247 Entry<R, Map<C, V>> rowEntry;
248
249 Iterator<Entry<C, V>> columnIterator = Iterators.emptyModifiableIterator();
250
251 @Override
252 public boolean hasNext() {
253 return rowIterator.hasNext() || columnIterator.hasNext();
254 }
255
256 @Override
257 public Cell<R, C, V> next() {
258 if (!columnIterator.hasNext()) {
259 rowEntry = rowIterator.next();
260 columnIterator = rowEntry.getValue().entrySet().iterator();
261 }
262 Entry<C, V> columnEntry = columnIterator.next();
263 return Tables.immutableCell(rowEntry.getKey(), columnEntry.getKey(), columnEntry.getValue());
264 }
265
266 @Override
267 public void remove() {
268 columnIterator.remove();
269 if (rowEntry.getValue().isEmpty()) {
270 rowIterator.remove();
271 }
272 }
273 }
274
275 @Override
276 public Map<C, V> row(R rowKey) {

Callers

nothing calls this directly

Calls 3

iteratorMethod · 0.65
entrySetMethod · 0.65

Tested by

no test coverage detected