Array to List (W06)




    The code creates an array of int values. The code iterates through the list, assigning each element to a new array. It then returns the array.

    public static List arrayToList(int[] a){
      List result =null;
      for(int i = a.length-1; i>=0; --i){
        result = new List(a[i], result);
      return result;
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.