【发布时间】:2017-01-17 22:00:17
【问题描述】:
我正在研究一种将 ArrayList 字符串保存到 .txt 文档中的方法,然后打开它,修改 ArrayList 字符串然后关闭它等等。
目前,我正在使用它再次打开 ArrayList:
ArrayList.add(fileIn.nextLine())
这可行,但并不像预期的那样,因为在保存数组列表后会发生这种情况:
[ [ [ [ ], 7,68, 9,71, 11,73, 13,72, 12,70], 9,72, 11,73, 13,72, 12,70, 10,69, 9,71], 6,76, 6,78, 8,77, 8,75, 7,74]
数组列表“重叠”。有什么方法可以保存或加载数组列表而不重叠?
谢谢!
【问题讨论】:
-
我在the
ArrayListdocumentation... 中没有看到静态的add(String str)方法 -
add类中没有静态方法add... -
我使用了 ArrayList。举个例子。