62,621
社区成员
发帖
与我相关
我的任务
分享import java.util.HashSet;
import java.util.Set;
public class ShortSet {
public static void main(String[] args) {
// TODO Auto-generated method stub
Set<Short> s = new HashSet<Short>();
for(Short i=0; i<100; i++){
s.add(i);
s.remove(i-1);
}
System.out.println(s.size());
}
} Short m=1;
Integer t=1;
System.out.println(m.equals(t)); System.out.println(s.remove(i-1));
if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call).
可以这样测试下你把s.remove(i-1);改成remove((short)(i-1))试一下。
你把s.remove(i-1);改成remove((short)(i-1))试一下。