private List<T> getValues(boolean selected) {
        List<T> values = new ArrayList<>();
        for (Entry<B, T> e : buttonValueMap.entrySet()) {
            if (selected && e.getKey().isSelected()) {
                values.add(e.getValue());
            } else if (!selected && !e.getKey().isSelected()) {
                values.add(e.getValue());
            }
        }
        return values;
    }