Java tutorial
//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(); } } }