Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Java Program to find keys from a Linked HashMap

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class Demo {
	public static void main(String[] args) {
		Map<String, String>map = new LinkedHashMap<String, String>();
		map.put("1", "Katie");
		map.put("2", "Peter");
		map.put("3", "Amy");
		map.put("4", "Kane");
		map.put("5", "Colin");
		map.put("6", "Andre");
		map.put("7", "Pollard");
		map.put("8", "David");
		map.put("9", "Jofra");
		map.put("10", "Akila");
		List<String>list = new ArrayList<String>();
		list.addAll(map.keySet());
		System.out.println("Keys...");
		for (String str: list) {
		 System.out.println(str);
		}
	}
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.