Convert array to list

static<T> List<T> asList(T... a)
Returns a fixed-size list backed by the specified array.

Create List from Object Array


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

public class Main {
  public static void main(String[] args) {
    String[] strArray = new String[] { "java2s.com", "A", "B", "C", "D" };
    List list = Arrays.asList(strArray);
    System.out.println(list);

  }
}

The output:


[java2s.com, A, B, C, D]
Home 
  Java Book 
    Collection  

Arrays:
  1. Arrays
  2. Convert array to list
  3. Binary search an Array
  4. Deep to string
  5. Compare two arrays
  6. Fill value to array
  7. Sort an array
  8. Convert array to string