You are not qualified to access a private field. You are currently trying to reassign the parameter passed to the constructor. Instead, you should use the following code:
public Example(String... values) { this.values = new HashSet<String>(Arrays.asList(values)); }
This can be further reduced by using the Diamond Operator, which is available since Java 7:
public Example(String... values) { this.values = new HashSet<>(Arrays.asList(values)); }
source share