descendingiterator

Why does Java compiler give “error: cannot find symbol” for LinkedList descendingIterator in the following code?

余生长醉 提交于 2020-01-06 08:05:21
问题 Why does this code: import java.util.*; class Playground { public static void main(String[ ] args) { List<Integer> l = new LinkedList<>(); Iterator<Integer> i = l.descendingIterator(); } } Generate this compiler error ./Playground/Playground.java:5: error: cannot find symbol Iterator<Integer> i = l.descendingIterator(); ^ symbol: method descendingIterator() location: variable l of type List<Integer> 1 error Here is the relevant JavaDocs API Running Java 7.. In case that is issue. Thought it