'while' statement cannot complete without throwing an exception
while(true){}'while'循环在不出现异常时无法终结;
但有时候需要如此;
解决方式:
@SuppressWarings("InfiniteLoopStatement")
call to asList with only one argument
Arrays.asList 转换基本数据类型时会提示异常
int[] arr ={1,2,3};
Arrays.asList(arr);
查看Arrays源码:
public static <T> List<T> asList(T... a){return new ArrayList<>(a);}
Arrays asList方法使用了可变参数,会将基本类型数组对象当作一个引用对象处理
解决方式1:
List list =Arrays.stream(arr).boxed().collect(Collectors.toList());
解决方式2:
Integer[] arr ={1,2,3};
List list = Arrays.asList(arr);
while(true) :'while' statement cannot complete without throwing an exception 'while'循环在不出现异常时无法终结,但有时候需要如此;解决方式:@SuppressWarings("InfiniteLoopStatement")