Here is what I\'m trying to use. The method .length doesn\'t work for anything I try, so I\'m not even sure where to begin.
import java.util.ArrayList;
public c
Here in your code you need to update at 2 places:
1) In lengths method you are passing list(ArrayList
), but you are not iterating over that you. You have to iterate over this list.
2) In the for loop you have made the variable as int, while the list is of type String. So update your code like below :
public static ArrayList lengths(ArrayList list) {
for (String nums: list) {
System.out.println(nums.length());
}
return lengthList;
}