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;
// w  w  w  .  j  a v a 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;
  }
}