Home » Posts tagged 'how to find duplicate keys in hashmap'

Tag Archives: how to find duplicate keys in hashmap

Newly Updated Posts

HashMap: Multiple Values under one key

In this tutorial learn how to put multiple values in single Key in HashMap.

Code:

package com.sanity.Methods;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class HashMapCode {
public static void main(String[] args) {
HashMap	map =new HashMap<String, List<String>>();
List<String> addValue= new ArrayList<>();
addValue.add("First");
addValue.add("Second");
addValue.add("Third");
addValue.add("Fourth");
addValue.add("Fifth");
addValue.add("Sixth");
map.put("Name", addValue);
		
System.out.println("All the Values under Name Key--------->"+addValue);
		
		
	}

}

Consider above code for adding multiple values in single key in hashmap

Further topics on selenium, navigate to link