Question: I am trying to declare an array of `Set<String>` so I do not have to manage each sets separately. But things go wrong:

```
      ArrayList<Set<String>> categories=new LinkedHashSet<>();

```

Here, Java says that type `Set<String>` is erroneous and then reports an error.

If this is wrong, then how can I make an array of :

```
static  Set<String> category1 = new LinkedHashSet<>();

```

Answer: 
You are initialising an ArrayList with LinkedHashSet object and hence the error:

```
  ArrayList<Set<String>> categories=new LinkedHashSet<>();

```

change it to

```
  ArrayList<Set<String>> categories=new ArrayList<>();

```

you need to use HashSet when you create a Set to be added into the list. Something like this:

```
      Set<String> firstSet = new HashSet<String>();
      //build your set 
      //add set to list
      categories.add(firstSet);

```

Btw, you mentioned Array in your question description, so here is the declaraiton for plain array of Sets:

```
      Set<String>[] categories=new HashSet[10];

```
You can do something like:

```
List<HashSet> list =new ArrayList<HashSet>();
HashSet<String> hs =new HashSet<String>();
hs.add(value1);
hs.add(value2);
list.add(hs);

```

You can use for or while loop to add values to set(hs) and then add the set to list.