How to initialize HashSet in java

We have many ways to initialize HashSet in java.
HashSet can be initialized in one line, Using constructors, Using Arrays.

1. Initialize HashSet using Constructors

2. Initialize HashSet in One line using Arrays.asList()

3. Initialize HashSet using Collections (Another List)


1. HashSet

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn