将数组转换为对象的迭代器。
//package com.nowjava; import java.lang.reflect.Array; import java.util.Iterator;//from nowjava.com - 时代Java public class Main { /** * Converts an array to an iterator of objects. */ public static Iterator<Object> toIteratorArray(final Object array) { final int length = Array.getLength(array); return new Iterator<Object>() { int index = 0; @Override public boolean hasNext() { return index < length; } /** 来自 时 代 J a v a - N o w J a v a . c o m**/ @Override public Object next() {