I need to create a Set
with initial values. 我须要建立一个具备初始值的Set
。 this
Set<String> h = new HashSet<String>(); h.add("a"); h.add("b");
Is there a way to do this in one line of code? 有没有办法在一行代码中作到这一点? For instance, it's useful for a final static field. 例如,它对于最终的静态字段颇有用。 spa