List<T> (boolean isMarked) { Map<T, Boolean> elementMarkStates = getElementMarkStates(); List<T> elements = new ArrayList<>(); for (Map.Entry<T, Boolean> entry : elementMarkStates.entrySet()) { if (entry.getValue() == isMarked) { elements.add(entry.getKey()); } } return elements; }