Create an empty Map in Java

Description

The following code shows how to create an empty Map.

Example


//from  w w w .j a v  a  2 s .co  m
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Main {
  public static void main(String args[]) {
    Map map = Collections.EMPTY_MAP;
    Map<Date, String> d = Collections.emptyMap();

  }
}




















Home »
  Java Tutorial »
    Java Collection »




Java ArrayList
Java Collection
Java Comparable
Java Comparator
Java HashMap
Java HashSet
Java Iterator
Java LinkedHashMap
Java LinkedHashSet
Java LinkedList
Java List
Java ListIterator
Java Map
Queue
Java Set
Stack
Java TreeMap
TreeSet