search

Home  >  Q&A  >  body text

java编译器报错,类型ListIterator不带有参数?

public class ListIterator {
    public static void main(String[] args) {
        List<Integer> listen = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            listen.add(i);
        }
        List<Integer> listen1 = new ArrayList<>();
        for (int i = 5; i < 10; i++) {
            listen1.add(i);
        }
        ListIterator<Integer> it = listen1.listIterator(listen1.size());
        while(it.hasPrevious()){
            listen.add(it.previous());
        }
        System.out.println(listen);
    }
}

编译报错,类型ListIterator不带有参数,请问是什么原因,上面的这段代码应该怎么修改,谢谢。
JDK版本1.8.0_65

怪我咯怪我咯2770 days ago1006

reply all(4)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 16:23:22

    Solved, the code is fine. It’s a problem with my java project

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 16:23:22

    Because it has the same name as your customized classListIterator

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 16:23:22

    Generic new ArrayList<Integer>()

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 16:23:22

    Android Studio compiles normally. . . . .

    reply
    0
  • Cancelreply