for(int i =0; i < size; i++) { List<String> s = sourceList.subList(s,t); }
I want to create s + i files in this place List s (s1, s2, etc.).
for(int i =0; i < size; i++) { List<String> s = sourceList.subList(s,t); }
I want to create s + i files in this place List s (s1, s2, etc.).
In java, as in almost all languages with static typing, this is not possible. But you do not need the variables s1, s2, s3 ... You can create an array of variables of any type (even an array type). In Java, this might look like this: ArrayList<List<String>> s = new ArrayList<>();
further s.add(sourceList.subList(i*10,(i+1)*10))
Took the constant from your previous question.
Source: https://ru.stackoverflow.com/questions/547813/
All Articles