I have two ArrayLists:
ArrayList<Integer> keySet = new ArrayList<Integer>();
and
ArrayList<String> values = new ArrayList<String>();
How would I create a HashMap using the keySet ArrayList as the keyset in the hashmap and the values ArrayList as the values in the HashMap?
HashMap. A key is always associated with the value you give it. The answer below will associate them by their index order, but any modifications after that and the two collections will diverge.HashMapalone also does not preserve order, your keys won't necessarily print in the same order you put them in.