class SelectiveRecordReaderEventIterator implements EventIterator {

    protected static List<File> filterUnneededFiles(final List<File> filesToRead, final List<Long> eventIds) {
        final List<File> files = new ArrayList<>();
        final Long firstEventId = eventIds.get(0);
        final Long lastEventId = eventIds.get(eventIds.size() - 1);

        final List<File> sortedFileList = new ArrayList<>(filesToRead);
        Collections.sort(sortedFileList, DirectoryUtils.SMALLEST_ID_FIRST);

        File lastFile = null;
        for (final File file : filesToRead) {
            final long firstIdInFile = DirectoryUtils.getMinId(file);
            if (firstIdInFile > lastEventId) {
                continue;
            }

            if (firstIdInFile > firstEventId) {
                if (files.isEmpty() && lastFile != null) {
                    files.add(lastFile);
                }

                files.add(file);
            }

            lastFile = file;
        }

        if (files.isEmpty() && lastFile != null) {
            files.add(lastFile);
        }

        return files;
    }

    public  SelectiveRecordReaderEventIterator(final List<File> filesToRead, final RecordReaderFactory readerFactory, final List<Long> eventIds, final int maxAttributeChars);

}