2 Answers
New Answerif class Obj has String name; field then for (Obj o : array) map.put(o.name, o); //or array.forEach(o -> map.put(o.name, o) );
May be like this, If not then please provide more details about your question HashMap<String, String> myHashmap = new HashMap<String, String>(); pseudo code for each element K in your ArrayList myHashMap.put(K, "some_value");
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message