*/
public Iterator<E> iterator() throws WMIException {
try {
JIVariant variant = dispatch.get("_NewEnum");
IJIComObject setObj = variant.getObjectAsComObject();
final IJIEnumVariant enumVariant = (IJIEnumVariant) JIObjectFactory.narrowObject(setObj.queryInterface(IJIEnumVariant.IID));
final int count = getCount();
final Class<?> elementClass = getElementType();
return new Iterator<E>() {
private int index = 0;
@Override
public boolean hasNext() {
return index < count;
}
@Override
public E next() {
try {
Object[] objs = enumVariant.next(1);
JIArray array = (JIArray)objs[0];
Object[] arrayObj = (Object[])array.getArrayInstance();
JIVariant ele = (JIVariant)arrayObj[0];
IJIDispatch dispatch = (IJIDispatch) JIObjectFactory.narrowObject(ele.getObjectAsComObject());
@SuppressWarnings("unchecked")