Johnny
0
Q:

add in list java

List mylist.addAll(secondList);
3
List<SomePojo> list = new ArrayList<SomePojo>();

List<SomePojo> anotherList = new ArrayList<SomePojo>();
anotherList.add(list);
1
// Java code to show the implementation of 
// add method in list interface 
import java.util.*; 
public class GfG { 
  
    // Driver code 
    public static void main(String[] args) 
    { 
        List<Integer> l = new ArrayList<>(); 
        l.add(10); 
        l.add(15); 
        l.add(20); 
        System.out.println(l); 
    } 
} 
0

New to Communities?

Join the community