Java, Data Structures, Arraylist, Set, Hashmap.
list = new ArrayList<>(); list.add("foo"); list.add("bar"); list.add("baz"); Map<String, Integer> map = new HashMap<>(); for (int i = 0; i < list.size(); i++) { map.put(list.get(i), i); } 8. Converting a Set to an Array To convert a Set to an Array in Java, you can create a new array with the same