Java 将字符串转换为Arraylist

Java 将字符串转换为Arraylist,java,android,Java,Android,我有一个大的文本文件,我想把它放到ArrayList中。我的文本文件开头包含符号,下面是文本文件数据 #These classes define the style and structure for your dialog, but you should use a DialogFragment as a container for your dialog. The DialogFragment class provides all the controls you need to cre

我有一个大的文本文件,我想把它放到ArrayList中。我的文本文件开头包含符号,下面是文本文件数据

  #These classes define the style and structure for your dialog, but you should use a DialogFragment as a container for your dialog. The DialogFragment class provides all the controls you need to create your dialog and manage its appearance, instead of calling methods on the Dialog object.
  #These classes define the style and structure for your dialog, but you should use a DialogFragment as a container for your dialog. The DialogFragment class provides all the controls you need to create your dialog and manage its appearance, instead of calling methods on the Dialog object.
  #These classes define the style and structure for your dialog, but you should use a DialogFragment as a container for your dialog. The DialogFragment class provides all the controls you need to create your dialog and manage its appearance, instead of calling methods on the Dialog object.

可以使用以下代码拆分字符串

String[] divide = string.split("#");
然后你可以用

List<String> stringList = new ArrayList<String>(Arrays.asList(divide)); 

这会将字符串数组转换为ArrayList。

使用String.split转换为String[]并使用Arrays.aslist在SO中请求某些内容之前,您应该先尝试一下,如果您尝试了但自己无法获取,SO用户会尝试帮助您。您尝试了什么?你考虑过使用什么方法?当你搜索谷歌和这里现有的问题时,你学到了什么?可能是重复的