Sorry i really dont know how to do this, last resort but to ask. I wanted to add values to the string list. But my code is not working
private List<String> sample = new ArrayList<String>(){"item1","item2","item3"};
Here it is:
List<String> sample = new ArrayList<String>(Arrays.asList("item1", "item2", "item3"));
Try,
ArrayList<String> list = new ArrayList<String>() {{
add("item1");
add("item2");
add("item3");
}}
OR
ArrayList<String> list = new ArrayList<String>();
list.add("item1");
list.add("item2");
list.add("item3");
private List<String>
and answers stipulateArrayList<String>
which is another thing. So this is not actually even answered properly. But fulfilled the cause.