[Solved] Get an item by index from the HashSet array and also display the average length of each item in the list [closed]


A Set is not what you want, because:

  • Sets only hold unique values
  • The elements of a Set have no order, so you can’t access elements by index

A better choice is a List, such as an ArrayList, which allows any (ie duplicate) values and can be accessed by index using list.get(i).

2

solved Get an item by index from the HashSet array and also display the average length of each item in the list [closed]