写一个方法传递List对象
import java.util.*;
..................
static int i;
public static void Test(List a){
a.add(1, "x"); // Add at location 1
a.add("x"); // Add at end
addAll(fill(new ArrayList()));
a.addAll(3, fill(new ArrayList()));
.........................
i = a.indexOf("1"); // Tell index of object
i = [color=red]a.indexOf("1", 2);[/color]
[color=red] i = a.lastIndexOf("1", 2 );[/color]
..................................
// Remove elements in this range:
[color=red]a.removeRange(0, 2);[/color]
.................................
}
为什么红色这两处会报错?
第一处报:
The method indexOf(Object) in the type List is not applicable for the arguments (String, int)
第二处报:
The method lastIndexOf(Object) in the type List is not applicable for the arguments (String, int)
第三处报:
The method removeRange(int, int) is undefined for the type List
小子我真的找不到原因了,请求各位帮忙。
谢谢~