Java Collection Tutorial - Java Collections EMPTY_MAP


Collections.EMPTY_MAP has the following syntax.

public static final Map EMPTY_MAP


In the following code shows how to use Collections.EMPTY_MAP field.

import java.util.Collections;
import java.util.Map;
/*from   www.  j  a v  a  2  s.c o m*/
public class Main {

  public static void main(String[] args) {
  public static Map getMy(){
    String nullFlag = null;
    if(nullFlag == null){
      return Collections.EMPTY_MAP;
    return null;