I am following link : How to initialize HashSet values by construction? and could be very silly question to ask, but I didn't make it working, please guide.
public class Demo {
public static void main(String[] args) {
Set<Double> tempSet = new HashSet<Double>();
tempSet.add(11.0);
tempSet.add(22.0);
// Below both lines not working
Set<Double> tempSet1 = new HashSet<Double>({11.0, 22.0});
Set<Double> tempSet1 = new HashSet<Double>(){11.0, 22.0};
}
}