I have unknown size of my ArrayList also it is always different size but it is cubic. Is there any way to part it to 3 strings subLists?
Code:
int number = mainList.size()/3;
for(int i= 1 ; i < mainList.size()/3; i++){
int index = i*3 ;
List<RootCreator> sublist = mainList.subList(0, index);
mainSublist.addAll(sublist);
}
I appreciate any help.
I am not sure about 3^n part but in general assuming you have inputStrList list, now break it into 3 parts.
ArrayList<String> subList1 = new ArrayList<String>(inputStrList.subList(0, start));
ArrayList<String> subList2= new ArrayList<String>(inputStrList.subList(start+1, middle));
ArrayList<String> subList3= new ArrayList<String>(inputStrList.subList(middle+1, end));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.