new LinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder) : LinkedHashMap « java.util « Java by API






new LinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder)

  
import java.util.LinkedHashMap;

public class Main {

  public static void main(String[] args) {
    LinkedHashMap<Integer, Integer> linkedMap = new LinkedHashMap<Integer, Integer>();
    for (int i = 0; i < 10; i++) {
      linkedMap.put(i, i);
    }

    System.out.println(linkedMap);
    // Least-recently used order:
    linkedMap = new LinkedHashMap<Integer, Integer>(16, 0.75f, true);

    for (int i = 0; i < 10; i++) {
      linkedMap.put(i, i);
    }
    System.out.println(linkedMap);
    for (int i = 0; i < 7; i++)
      System.out.println(linkedMap.get(i));
    System.out.println(linkedMap);
  }
}

   
    
  








Related examples in the same category

1.new LinkedHashMap()
2.LinkedHashMap: clear()
3.LinkedHashMap: containsKey(Object key)
4.LinkedHashMap: containsValue(Object value)
5.LinkedHashMap: get(Object key)
6.LinkedHashMap: put(K key, V value)
7.LinkedHashMap: remove(Object key)
8.LinkedHashMap: size()
9.LinkedHashMap: values()