Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
String line = "5 1973 2205 2396 2406"; String[] paperids = line.split(" "); List<String> paperList = Arrays.asList(paperids); paperList.remove(0);
这是我的 Java 代码,我想将 string[] 转移到 List 并删除 List 的第一项,但它在最后一行不起作用,有人可以帮我吗?非常感谢。
List返回的 from是Arrays.asList不可变的(不能更改)。这实际上是一个(烦人的)功能List
List
Arrays.asList
尝试创建一个ArrayList并使用数组值播种它
ArrayList
String line = "5 1973 2205 2396 2406"; String[] paperids = line.split(" "); List<String> paperList = new ArrayList<String>(Arrays.asList(paperids)); paperList.remove(0);
我正在使用 eclipse(juno 和以前的版本)来编写 JSF 代码。这些页面都是xhtml。每隔一段时间我需要添加javascript。当我这样做时,我必须使用 CDATA 标记,否则当我有某些字符(如 > < &)时 xhtml 无效。
无论如何,该解决方案运行良好,直到我告诉 eclipse 格式化代码,此时它删除了