LinkedHashMap() constructor from LinkedHashMap has the following syntax.
public LinkedHashMap()
In the following code shows how to use LinkedHashMap.LinkedHashMap() constructor.
import java.util.LinkedHashMap; /*from ww w . j a v a 2s . c om*/ public class Main { public static void main(String[] args) { LinkedHashMap<String, Integer> map = new LinkedHashMap<String, Integer>(); // add some values in the map map.put("One", 1); map.put("Two", 2); map.put("Three", 3); System.out.println(map); // clear the map map.clear(); System.out.println(map); } }
The code above generates the following result.