Check out example codes for "how to initialize a set in java". It will help you in understanding the concepts better.

Code Example 1

Set<String> set = new HashSet<>(Arrays.asList("a", "b", "c"));

Code Example 2

Set<E> h = new HashSet<E>();

Code Example 3

HashSet<String> h = new HashSet<String>();

Learn ReactJs, React Native from akashmittal.com