ClassElement makeListElement() { final TypeVariable typeVar = typeVar("E", itype(object)); final ClassElement element = element("List", itype(object), typeVar); DartTypeNode returnTypeNode = new DartTypeNode( new DartIdentifier("Iterator"), Arrays.asList(new DartTypeNode(new DartIdentifier("E")))); DartMethodDefinition iteratorMethod = DartMethodDefinition.create( new DartIdentifier("iterator"), new DartFunction( Collections.<DartParameter>emptyList(), new DartBlock(Collections.<DartStatement>emptyList()), returnTypeNode), Modifiers.NONE, Collections.<DartInitializer>emptyList()); MethodNodeElement iteratorMethodElement = Elements.methodFromMethodNode(iteratorMethod, element); Type returnType = Types.interfaceType(iterElement, Arrays.<Type>asList(typeVar)); FunctionType functionType = ftype(function, returnType, Collections.<String, Type>emptyMap(), null); Elements.setType(iteratorMethodElement, functionType); Elements.addMethod(element, iteratorMethodElement); return element; }