What I am trying to do is get the size of a list that I have created. However, I am getting an error stating that "The operator < is undefined for the argument type(s) int, Dimension"
public static void printElements(List someList) { for (int i = 0; i<someList.size(); i++) { System.out.println(someList.get(i)); } }
however,in my code size() is deprecated. So it doesn't get the value of someList. I've turned off deprecated and restricted API but still not working.
size()
someList
Yeah I imported java.awt.list instead of java.util.list.
Your issue's related to the library that you imported:
use:
import java.util.List;
instead:
import java.awt.List;
.size() it's deprecated to awt.List
2.1m questions
2.1m answers
60 comments
57.0k users