Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add String Array to ArrayList [duplicate]

I have 2 String Arrays

String[] question1 = {"Q1","Q2","Q3","Q4"}; String[] question2 = {"Q5","Q6","Q7","Q8"}; 

And one ArrayList

ArrayList<String> aList = new ArrayList<String>(); 

How can I manipulate them if i want to access to a member of ArrayList. I tried converting both arrays to String but it doesn't give solution.

like image 993
GlacialMan Avatar asked Apr 11 '16 22:04

GlacialMan


People also ask

Does ArrayList allow duplicate values?

ArrayList allows duplicate values in its collection. On other hand duplicate elements are not allowed in Hashset.


1 Answers

ArrayList<String> aList = new ArrayList<String>(Arrays.asList(question1)); aList.addAll(Arrays.asList(question2)); 
like image 87
user3114639 Avatar answered Sep 23 '22 05:09

user3114639