public <T extends HasCapacity> T select(List<T> list) {
        LOGGER.trace(() -> LogUtil.message("select() called on {} for items [{}]",
                this.getClass().getSimpleName(),
                dumpList(list)));

        if (list == null || list.isEmpty()) {
            throw new RuntimeException("No items provided to select from");
        } else {
            // Let the sub-class filter out items from the list if they want
            final List<T> filteredList = createFilteredList(list);

            if (filteredList.isEmpty()) {
                // We have filtered everything out so have to just grab from original
                // list with our fallback selector
                LOGGER.trace("All items filtered out so delegating to fallback selector");
                return fallbackSelector.select(list);
            } else if (filteredList.size() == 1) {
                return filteredList.get(0);
            } else {
                // Now let the sub-class do the selection
                T selected = doSelect(filteredList);

                LOGGER.trace(() -> LogUtil.message("Filtered items for {} [{}]",
                        this.getClass().getSimpleName(),
                        dumpList(filteredList)));

                if (selected == null && fallbackSelector != null) {
                    LOGGER.trace(() -> LogUtil.message(
                            "Falling back to selector {}",
                            fallbackSelector.getClass().getSimpleName()));
                    if (!filteredList.isEmpty()) {
                        selected = fallbackSelector.select(filteredList);
                    } else {
                        selected = fallbackSelector.select(list);
                    }
                }

                if (LOGGER.isTraceEnabled()) {
                    LOGGER.trace("{} selected: {}", this.getClass().getSimpleName(), itemToStr(selected));
                }
                return selected;
            }
        }
    }
Override this method if the selector needs to filter the original list of items.
The passed <pre>list</pre> should not be mutated.
stroom-util/src/main/java/stroom/util/io/capacity/AbstractSelector.java