(ugly) Double Brace Initialization without side effects:
Set<String> a = new HashSet<>(new HashSet<String>() {{
add("1");
add("2");
}})
But in some cases, if we mentioned that is a good smell to make final collections unmutable, it could be really useful:
final Set<String> a = Collections.unmodifiableSet(new HashSet<String>(){{
add("1");
add("2");
}})