Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;
import java.util.Collections;

import java.util.Iterator;

public class Main {
    /**
     * Returns an iterator on a collection even null.
     * @param collection Collection
     * @return Iterator
     */
    public static Iterator iterator(Collection collection) {
        if (collection == null) {
            return Collections.EMPTY_LIST.iterator();
        } else {
            return collection.iterator();
        }
    }
}