List of usage examples for java.util ArrayList size
int size
To view the source code for java.util ArrayList size.
Click Source Link
From source file:Main.java
public static String[] stringListToArray(ArrayList<String> list) { String string[] = new String[list.size()]; for (int i = 0; i < string.length; i++) { string[i] = list.get(i);/*www.j ava 2s . co m*/ } return string; }
From source file:Main.java
public static long[] buildLongArray(ArrayList<Long> longList) { long[] longArray = new long[longList.size()]; int i = 0;/*from w ww . j a v a 2 s .c om*/ for (Long l : longList) { longArray[i++] = l; } return longArray; }
From source file:Main.java
public static String[] intToString(ArrayList<Integer> list) { String string[] = new String[list.size()]; for (int i = 0; i < string.length; i++) { string[i] = Integer.toString(list.get(i)); }/*from w ww .jav a 2 s . co m*/ return string; }
From source file:Main.java
public static int[] CountElmt(ArrayList<Integer> newScores1, ArrayList<Integer> scores) { int a[] = new int[scores.size()]; for (int i = 0; i < scores.size(); i++) { a[i] = 0;/* w w w . j a v a2 s.c o m*/ } for (int i = 0; i < newScores1.size(); i++) { int value = newScores1.get(i); int pos = scores.indexOf(value); a[pos]++; } return a; }
From source file:Main.java
private static String[] toStringArray(ArrayList<String> arrayList) { String[] ret = new String[arrayList.size()]; for (int i = 0; i < ret.length; i++) { ret[i] = arrayList.get(i);/*from ww w. java 2s . c om*/ } return ret; }
From source file:Main.java
public static float[] toFloatArray(ArrayList<Float> arraylist) { float[] tmp = new float[arraylist.size()]; int i = 0;// w w w. ja v a 2 s . c o m for (float f : arraylist) { tmp[i] = f; i++; } return tmp; }
From source file:Main.java
public static float[] toFloatArray(ArrayList<Float> floats) { float returner[] = new float[floats.size()]; for (int i = 0; i < returner.length; i++) { returner[i] = floats.get(i);/*from w ww. j a v a 2 s . co m*/ } return returner; }
From source file:Main.java
public static String getNoCommandsAlert(ArrayList<String> commands) { if (commands == null || commands.size() == 0) { String warn = "<div class=\"alert alert-warning\" role=\"alert\">\n" + " <strong>No Commands listed</strong><br />\n" + " Have a look at the left panel to learn see to add commands" + "</div>"; return warn; }//w w w . j ava 2s. co m return ""; }
From source file:Main.java
static public double[] toDoubleArray(ArrayList list) { double[] result = new double[list.size()]; for (int i = 0; i < list.size(); i++) { Number n = (Number) list.get(i); result[i] = n.doubleValue();//from ww w.java 2 s . com } return result; }
From source file:Main.java
public static double[][] toArray(ArrayList<ArrayList<Double>> a) { int dataDimen = a.size(); double[][] res = new double[dataDimen][dataDimen]; for (int i = 0; i < dataDimen; i++) { for (int j = 0; j < dataDimen; j++) { res[i][j] = a.get(i).get(j); }/*from w ww . ja v a2s .c o m*/ } return res; }