Converting Array to Arraylist in Java Example

Array to ArrayList:

package in.javadomain;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ArrayTOArrayList {
	public static void main(String[] args) {
		String[] languagesArray = { "Tamil", "English", "Hindi", "Telugu" };
		List<String> langArrayList = new ArrayList<String>();
		Collections.addAll(langArrayList, languagesArray);
		for (Object value : langArrayList) {
			System.out.println("Value in ArrayList :::" + value);


Value in ArrayList :::Tamil
Value in ArrayList :::English
Value in ArrayList :::Hindi
Value in ArrayList :::Telugu

Moving Array values to ArrayList:

Collections.addAll(langArrayList, languagesArray);

650 total views, 3 views today

About Mirthbees 678 Articles
Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in

Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.