Example usage for java.util WeakHashMap size

List of usage examples for java.util WeakHashMap size

Introduction

In this page you can find the example usage for java.util WeakHashMap size.

Prototype

int size

To view the source code for java.util WeakHashMap size.

Click Source Link

Document

The number of key-value mappings contained in this weak hash map.

Usage

From source file:Main.java

public static void main(String[] args) {
    WeakHashMap<String, String> weakHashMap = new WeakHashMap<String, String>();

    System.out.println("Putting values into the Map");
    weakHashMap.put("1", "first");
    weakHashMap.put("2", "two");
    weakHashMap.put("3", "from java2s.com");

    // checking the size of the Map
    System.out.println("Map size: " + weakHashMap.size());
}