Class IComEnumVariantIterator

java.lang.Object
com.sun.jna.platform.win32.COM.IComEnumVariantIterator
All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<Variant.VARIANT>, Iterator<Variant.VARIANT>

public class IComEnumVariantIterator extends Object implements Iterable<Variant.VARIANT>, Iterator<Variant.VARIANT>, Closeable
Wrapper for an EnumVariant Iteration. The usecase is a for-loop in the style:
// Aquire an IDispatch, that has a new NewEnum Property (DISPID_NEWENUM)
for(VARIANT v: IComEnumVariantIterator.wrap(dispatch)) {
     // Work with the acquired Variant
     // ...
     // Finally free it
     OleAuto.INSTANCE.VariantClear(v);
}

The IComEnumVariantIterator iterator closes the enumeration it wraps after the enumeration is exhausted or when the iterator is GCed, whatever happens earlier.