LinkedHashSet<String> () { LinkedHashSet<String> nameSuggestions; String currentName = myDeclaration.getName(); if (myNameSuggestions.contains(currentName)) { nameSuggestions = myNameSuggestions; } else { nameSuggestions = new LinkedHashSet<>(); nameSuggestions.add(currentName); nameSuggestions.addAll(myNameSuggestions); } return nameSuggestions; }