SortingScoredDocumentIterator implements Iterator<SimpleScoredDocument> { @Override public void remove() { throw new UnsupportedOperationException("Removal is not supported"); } SortingScoredDocumentIterator(
            @NotNull
            final IndexedDatabase ctx,
            @NotNull
            final BitSet docs,
            @NotNull
            final List<Order> sorts); @Override boolean hasNext(); @Override SimpleScoredDocument next(); @Override void remove();  }
@Test(expected = UnsupportedOperationException.class) public void unsupportedRemove() throws IOException { final DatabaseBuilder dbBuilder = FORMAT.newDatabaseBuilder(); dbBuilder.merge( FORMAT.newDocumentBuilder() .withField("text", "doc1234", FULL) .withField("int", 1, FULL) .withPayload("payload1".getBytes())); dbBuilder.merge( FORMAT.newDocumentBuilder() .withField("text", "doc2", FULL) .withField("int", 2, FULL) .withPayload("payload2".getBytes())); final ByteArrayOutputStream os = new ByteArrayOutputStream(); dbBuilder.buildWritable().writeTo(os); final V1Database db = (V1Database) DatabaseFormat.getCurrent() .getDatabaseReader() .from(Buffer.from(os.toByteArray())); final SortingScoredDocumentIterator iterator = new SortingScoredDocumentIterator( db, new ReadOnlyOneBitSet(db.getDocumentCount()), Collections.singletonList(asc("text"))); iterator.remove(); }