Java Array to ArrayList toArrayList(int[] p)

Here you can find the source of toArrayList(int[] p)

Description

to Array List

License

Open Source License

Declaration

public static ArrayList<Integer> toArrayList(int[] p) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    public static ArrayList<Integer> toArrayList(int[] p) {
        ArrayList<Integer> ret = new ArrayList<>();
        for (int i = 0; i < p.length; i++) {
            ret.add(i);//from  w w w .  ja va2s  .c o  m
        }
        return ret;
    }

    public static double[][] add(double[][] a, double[][] b) {
        double[][] d = new double[a.length][a[0].length];
        if (isIdenticalMatrix(a, b)) {
            for (int i = 0; i < a.length; i++) {
                for (int j = 0; j < a[0].length; j++) {
                    d[i][j] = a[i][j] + b[i][j];
                }
            }
        } else {

        }
        return d;
    }

    private static boolean isIdenticalMatrix(double[][] a, double[][] b) {
        if (a.length == b.length && a[0].length == b[0].length) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. toArrayList( Iterable iterable)
  2. toArrayList(Collection collection)
  3. toArrayList(Collection from)
  4. toArrayList(double[] dd)
  5. toArrayList(final T... array)
  6. toArrayList(int[] values)
  7. toArrayList(List list)
  8. toArrayList(Object pObject)
  9. toArrayList(String str)