Can we convert a Java array to list?

We can use Arrays.asList() method to convert a Java array to List easily.


public static <T> List<T> asList(T... a)

Returns a fixed-size list backed by the specified array. (Changes to the returned list "write through" to the array.) This method acts as bridge between array-based and collection-based APIs, in combination with Collection.toArray(). The returned list is serializable and implements RandomAccess.

Type Parameter

  • − The runtime type of the array.


  • − The array by which the list will be backed.


A list view of the specified array.


The following example shows how to get immutable and mutable list using Arrays.asList() method.

package com.tutorialspoint;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class CollectionsDemo {
   public static void main(String[] args) {
      Integer[] array = {1,2,3,4,5,6};

      // Get a mutable list from array
      List<Integer> list = new ArrayList<>(Arrays.asList(array));
      System.out.println("List: " + list);

      // Get immutable list from array
      List<Integer> list1 = Arrays.asList(array);
      try {
      } catch(Exception e) {
      System.out.println("List: " + list1);


This will produce the following result −

List: [1, 2, 3, 4, 5, 6, 7] 
List: [1, 2, 3, 4, 5, 6] 
   at java.util.AbstractList.add( 
   at java.util.AbstractList.add( 
   at com.tutorialspoint.CollectionsDemo.main(