boolean (String description) { if (myDuplicateDescriptions == null) { assert myModel != null; myDuplicateDescriptions = new HashSet<>(); Set<String> filter = new HashSet<>(); for (int i = 0; i < myModel.getSize(); i++) { String s = myModel.getElementAt(i).getDescription(); if (!filter.add(s)) myDuplicateDescriptions.add(s); } } return myDuplicateDescriptions.contains(description); }