Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

best way to store a list of strings

What would be the best way to store and read a really long string, with each entry is an index for another array?

Right now I have this

String indices="1,4,6,19,22,54,....."

The string has up to hundred of thousand entries, so I think maybe I could use a data structure like Linked List. Does anyone know if it would be faster to use one?

like image 457
user1538814 Avatar asked Sep 06 '25 03:09

user1538814


1 Answers

List<String> list = new ArrayList<String>();

list.add("1");
list.add("2");

you need to declare arraylist of type string.Then add to it.

like image 200
PSR Avatar answered Sep 07 '25 17:09

PSR