class MyIterable implements Iterable{

    Cons head;

    static MyList of(int ...xs) {

        var list = new MyList();

        Cons head = null;

        for (int i = xs.length-1; i >= 0; i--)

            head = new Cons(xs[i],head);

        list.head = head;

        return list;

    }

    @Override public Iterator iterator() {

        return new MyIterator<>(this); 

    }

    

}


abstract class MyIterator implements Iterator{

    var x = new MyList();

    for (var x: list)

        System.out.print(x + " ");

}




|           return new MyIterator<>(this); 
cannot infer type arguments for MyIterator
  reason: cannot use '<>' with non-generic class MyIterator

MyIterable을 MyIterator 에 오버라이드하고싶은데 저리 오류가 뜸...