Java Collections EMPTY_MAP

Syntax

Collections.EMPTY_MAP has the following syntax.

public static final Map EMPTY_MAP

Example

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


import java.util.Collections;
import java.util.Map;
//from ww  w.j  a v a  2  s . com
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;
  }
}