Java Collection Tutorial - Java Collections .emptyListIterator ()








Syntax

Collections.emptyListIterator() has the following syntax.

public static <T> ListIterator <T> emptyListIterator()

Example

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

import java.util.Collections;
import java.util.ListIterator;
//www. j  a va 2 s.c  o m
public class Main {

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