MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.util.LinkedHashMap;

public class MainClass {

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

        System.out.println(linkedMap);
        // Least-recently used order:
        linkedMap = new LinkedHashMap(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++)
            // Cause accesses:
            System.out.println(linkedMap.get(i));
        System.out.println(linkedMap);
    }
}