Java Collections .emptyEnumeration ()

Syntax

Collections.emptyEnumeration() has the following syntax.

public static <T> Enumeration <T> emptyEnumeration()

Example

In the following code shows how to use Collections.emptyEnumeration() method.


//w  w w  . j  a  va 2 s.c  om
import java.util.Collections;
import java.util.Enumeration;

public class Main {

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