LinkedListStarTreeTable implements StarTreeTable { @Override public StarTreeTable view(Integer startDocumentId, Integer documentCount) { return new LinkedListStarTreeTable(list.subList(startDocumentId, startDocumentId + documentCount), dimensionTypes, metricTypes); } LinkedListStarTreeTable(List<FieldSpec.DataType> dimensionTypes, List<FieldSpec.DataType> metricTypes); private  LinkedListStarTreeTable(List<ByteBuffer> list,
                                  List<FieldSpec.DataType> dimensionTypes,
                                  List<FieldSpec.DataType> metricTypes); @Override void append(StarTreeTableRow row); @Override int size(); @Override Iterator<StarTreeTableRow> getUniqueCombinations(final List<Integer> excludedDimensions); @Override Iterator<StarTreeTableRow> getAllCombinations(); @Override void sort(final List<Integer> sortDimensions); @Override StarTreeTableGroupByStats groupBy(Integer dimension); @Override StarTreeTable view(Integer startDocumentId, Integer documentCount); @Override void printTable(PrintStream printStream); @Override void close();  }
@Test(dataProvider = "viewTableDataProvider") public void testView(StarTreeTable table) { for (List<Integer> combination : generateCombinations()) { table.append(new StarTreeTableRow(combination, metrics)); } table.sort(ImmutableList.of(0, 1)); StarTreeTable view = table.view(0, 64); Assert.assertEquals(view.size(), 64); Iterator<StarTreeTableRow> itr = view.getAllCombinations(); while (itr.hasNext()) { List<Integer> row = itr.next().getDimensions(); Assert.assertEquals(row.get(0), Integer.valueOf(0)); } view = table.view(64, 64); Assert.assertEquals(view.size(), 64); itr = view.getAllCombinations(); while (itr.hasNext()) { List<Integer> row = itr.next().getDimensions(); Assert.assertEquals(row.get(0), Integer.valueOf(1)); } view = view.view(0, 32); Assert.assertEquals(view.size(), 32); itr = view.getAllCombinations(); while (itr.hasNext()) { List<Integer> row = itr.next().getDimensions(); Assert.assertEquals(row.get(1), Integer.valueOf(1)); } }