class Selectors {

    public static <T> SelectorFunction<Collection<T>, T> single(final T preference) {
        return new SelectorFunction<Collection<T>, T>() {
            @Override
            public T select(Collection<T> items) {
                return items.contains(preference)
                        ? preference
                        : null;
            }
        };
    }

}