Sample case:
class Test {
final Set<String> uniqueNames = new HashSet<String>();
}
But w/ the help of a plugin can generate methods like this (similar to Generate getters/setters)
class Test {
final Set<String> uniqueNames = new HashSet<String>();
public boolean add(String name) {
return uniqueNames.add(name);
}
public boolean remove(Object name) {
return uniqueNames.remove(name);
}
}