This method returns the Iterator of the list object being passed - Java java.util

Java examples for java.util:List Operation

Description

This method returns the Iterator of the list object being passed

Demo Code


//package com.java2s;
import java.util.Iterator;
import java.util.List;

public class Main {
    public static void main(String[] argv) {
        List listObj = java.util.Arrays.asList("asdf", "java2s.com");
        System.out.println(getIteratorForList(listObj));
    }//  w  w w . j  a  v a  2 s.  c o  m

    /**
     * <p>
     * This method returns the <tt>Iterator</tt> of the <tt>list</tt> object
     * being passed
     * </p>
     * 
     * @param listObject
     *       the list instance whose iterator needs to be returned
     * 
     * @return
     *       the <tt>Iterator</tt> of the list instance
     */
    public static Iterator<? extends Object> getIteratorForList(
            List<? extends Object> listObj) {
        return listObj.iterator();
    }
}

Related Tutorials