欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

有趣的事 java 

程序员文章站 2024-03-15 11:57:47
...
	public static void main(String[] args) {
		String[] field = {"rh","pr1","wd","ws","t","p"};
		List<String> fieldList =Arrays.asList(field);
		fieldList.remove("pr1");
	}

用数组转的List 调用remove 方法会报错,应该数组转List 并不是完全转化
Exception in thread "main" java.lang.UnsupportedOperationException
	at java.util.AbstractList.remove(Unknown Source)
	at java.util.AbstractList$Itr.remove(Unknown Source)
	at java.util.AbstractCollection.remove(Unknown Source)
	at com.kedalo.base_service.comm.RestfulApiRecord.main(RestfulApiRecord.java:264)
相关标签: java