-5

I have a large text file and I want to put it into ArrayList. My text file contain # signs at start, here is text file data.

  #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.
M.ArslanKhan
  • 3,640
  • 8
  • 34
  • 56
  • 1
    Use `String.split("#")` to convert to `String[]` and use `Arrays.asList()` – Andrew T. Jan 12 '14 at 14:54
  • You should have a try before asking something in SO, if you try and can't get it by yourself that's when the SO users will try to help you. – nKn Jan 12 '14 at 14:54
  • 1
    What have you tried? What methods have you considered using? What did you learn when you searched Google and the existing questions here? – Simon Jan 12 '14 at 14:54
  • possible duplicate of [How to split a String in Java](http://stackoverflow.com/questions/3481828/how-to-split-a-string-in-java) – CommonsWare Jan 12 '14 at 14:57

1 Answers1

1

You can split the String using the following code

String[] divide = string.split("#");

then you can use

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

This will convert String array to ArrayList.

Rohan Kandwal
  • 9,112
  • 8
  • 74
  • 107