The 1st example wrongly iterates over the IAtoms via an Iterator object, which returns a Type Matching error.
Iterator<iatom> atoms = methane.atoms(); </iatom>
Instead, an expression like this would preferred:
for (IAtom atom : methane.atoms()) {
}
Patch filed as:
https://sourceforge.net/tracker/?func=detail&aid=3044315&group_id=20024&atid=320024
Patch has been applied.