For a personal project of mine of which I already have written the code for the console version of it, I need an ArrayList of strings. The strings of the ArrayList are added via console input. This is how I did that:
ArrayList<String> input = new ArrayList<>();
Scanner sc = new Scanner(System.in);
while (sc.hasNextLine()) {
String lineNew = sc.nextLine();
if (lineNew.isEmpty()) {
break;
}
input.add(lineNew);
}
So I basically add each line the Scanner reads to the ArrayList.
So what I did in my JavaFX version was that I created a textarea of what I will get the input from. After printing the class of the output i saw that the gettext() method of a textarea returns a String and not an ArrayList, which is already kind of strange on its own since the input contained enters. Anyways, is there a method which returns an ArrayList of strings instead of just a string with a textarea, or a different kind of text field, or do I need to make substrings out of the long string and put it into an ArrayList, or is there something else I could do.
Thanks in advance.