In this Program, we are going to share Java program to Join Two Lists with the output. If you are a Java beginner and want to start learning the Java programming, then keep your close attention in this tutorial as I am going to share how to write a Java program to Join Two Lists.
Java program to Join Two Lists with the output
Copy the below Java program and execute it with the help of Javac compiler. At the end of this program, We have shared the output of this program.
import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.ListUtils; public class JoinListsProgram { public static void main(String[] args) { Listl1 = new ArrayList (); list1.add("a"); List l2 = new ArrayList (); list2.add("b"); List joined = ListUtils.union(l1, l2); System.out.println("list1: " + l1); System.out.println("list2: " + l2); System.out.println("joined: " + joined); } }
Liked this program? Do Like & share with your friends.
The post Java program to Join two lists appeared first on FreeWebMentor.
This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here