How to initialize HashSet values by construction for Double? : <p>I am following link : <a href="https://stackoverflow.com/questions/2041778/how-to-initialize-hashset-values-by-construction?newreg=dcfb635715de40c4aee35a851fc103fd">How to initialize HashSet values by construction?</a> and could be very silly question to ask, but I didn't make it working, please guide.</p>

<pre><code>public class Demo {
    public static void main(String[] args) {
        Set&lt;Double&gt; tempSet = new HashSet&lt;Double&gt;();
        tempSet.add(11.0);
        tempSet.add(22.0);

        // Below both lines not working
        Set&lt;Double&gt; tempSet1 = new HashSet&lt;Double&gt;({11.0, 22.0});
        Set&lt;Double&gt; tempSet1 = new HashSet&lt;Double&gt;(){11.0, 22.0};
    }
}
</code></pre>
