Java Collection Tutorial - Java Collections EMPTY_LIST








Syntax

Collections.EMPTY_LIST has the following syntax.

public static final List EMPTY_LIST

Example

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

import java.util.Collections;
import java.util.List;
/*from   w w  w.ja  v  a2 s .  c om*/
public class Main {

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