private List<ColumnOrSuperColumn> thriftifySuperColumns(Iterator<LegacyLayout.LegacyCell> cells, boolean reversed) { ArrayList<ColumnOrSuperColumn> thriftSuperColumns = new ArrayList<>(); SuperColumn current = null; while (cells.hasNext()) { LegacyLayout.LegacyCell cell = cells.next(); ByteBuffer scName = cell.name.superColumnName(); if (current == null || !scName.equals(current.bufferForName())) { // Generally, cells come reversed if the query is reverse. However, this is not the case within a super column because // internally a super column is a map within a row and those are never returned reversed. if (current != null && reversed) Collections.reverse(current.columns); current = new SuperColumn(scName, new ArrayList<>()); thriftSuperColumns.add(new ColumnOrSuperColumn().setSuper_column(current)); } current.getColumns().add(thriftifySubColumn(cell, cell.name.superColumnSubName())); } if (current != null && reversed) Collections.reverse(current.columns); return thriftSuperColumns; }
private List<ColumnOrSuperColumn> thriftifySuperColumns(Iterator<LegacyLayout.LegacyCell> cells, boolean reversed) { ArrayList<ColumnOrSuperColumn> thriftSuperColumns = new ArrayList<>(); SuperColumn current = null; while (cells.hasNext()) { LegacyLayout.LegacyCell cell = cells.next(); ByteBuffer scName = cell.name.superColumnName(); if (current == null || !scName.equals(current.bufferForName())) { // Generally, cells come reversed if the query is reverse. However, this is not the case within a super column because // internally a super column is a map within a row and those are never returned reversed. if (current != null && reversed) Collections.reverse(current.columns); current = new SuperColumn(scName, new ArrayList<>()); thriftSuperColumns.add(new ColumnOrSuperColumn().setSuper_column(current)); } current.getColumns().add(thriftifySubColumn(cell, cell.name.superColumnSubName())); } if (current != null && reversed) Collections.reverse(current.columns); return thriftSuperColumns; }
private List<ColumnOrSuperColumn> thriftifySuperColumns(Collection<Cell> cells, boolean reverseOrder, long now) { ArrayList<ColumnOrSuperColumn> thriftSuperColumns = new ArrayList<ColumnOrSuperColumn>(cells.size()); SuperColumn current = null; for (Cell cell : cells) { if (!cell.isLive(now)) continue; ByteBuffer scName = SuperColumns.scName(cell.name()); if (current == null || !scName.equals(current.bufferForName())) { current = new SuperColumn(scName, new ArrayList<Column>()); thriftSuperColumns.add(new ColumnOrSuperColumn().setSuper_column(current)); } current.getColumns().add(thriftifySubColumn(cell).setName(SuperColumns.subName(cell.name()))); } if (reverseOrder) Collections.reverse(thriftSuperColumns); return thriftSuperColumns; }