Converting an Array to a Collection : Array Collections « Collections Data Structure « Java






Converting an Array to a Collection

     

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

public class Main {
  public static void main(String[] argv) throws Exception {
    int[] array = new int[10];
    // Fixed-size list
    List list = Arrays.asList(array);
  }
}

   
    
    
    
    
  








Related examples in the same category

1.Array Iterator
2.Array MapArray Map
3.Array SetArray Set
4.Array Int Set
5.Remove duplicate element from array
6.Convert an Array to a List
7.Converting a Collection of user objects to an Array
8.Create an array containing the elements in a set
9.Convert an array to a Map
10.Converting a Collection of String to an ArrayConverting a Collection of String to an Array
11.Treating an Array as an Enumeration
12.ArrayEnumeration class (implements Enumeration)ArrayEnumeration class (implements Enumeration)
13.Custom ArrayMap implementation (extends AbstractMap)Custom ArrayMap implementation (extends AbstractMap)
14.Custom ArraySet implementation (extends AbstractSet)Custom ArraySet implementation (extends AbstractSet)
15.Converts array into a java.util.Map.
16.Growable array of intsGrowable array of ints
17.Growable array of floats.
18.Acts like an java.util.ArrayList but for primitive int valuesActs like an java.util.ArrayList but for primitive int values
19.Acts like an java.util.ArrayList but for primitive long values
20.Add array to collection