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
/** * Decides whether TCK should be present based in the ATR on the "T" values * found when parsing the ATR.// w w w . j av a2 s . co m * * From ISO/IEC 7816-3 8.2.5: "If only T=0 is indicated, possibly by * default, then TCK shall be absent. If T=0 and T=15 are present and in all * the other cases, TCK shall be present." * * @param tValues The values of "T" found when parsing the ATR. * * @return true if TCK should be present, false otherwise. */ private static boolean isTckPresent(ArrayList<Integer> tValues) { return !((tValues.size() == 1) && tValues.contains(0)); }
From source file:Main.java
/** * transforms an ArrayList of Double values to an Array of double values * @param _list the ArrayList with Double values * @return an array with double values/*from ww w . j a va2s. c o m*/ */ public static double[] getDoubleArrayFromArrayList(ArrayList<Double> _list) { double[] res = new double[_list.size()]; for (int i = 0; i < res.length; i++) { res[i] = _list.get(i).doubleValue(); } return res; }
From source file:Main.java
public static int[] buildIntArray(ArrayList<Integer> integerList) { int[] intArray = new int[integerList.size()]; int i = 0;/* www . j a v a 2 s . c om*/ for (Integer j : integerList) { intArray[i++] = j; } return intArray; }
From source file:Main.java
public static void ensureSize(ArrayList<?> collection, int size) { while (collection.size() < size) { collection.add(null);/*ww w. j ava 2s . c o m*/ } }
From source file:Main.java
private static boolean[] toBooleanArray(ArrayList<Boolean> arrayList) { boolean[] ret = new boolean[arrayList.size()]; for (int i = 0; i < ret.length; i++) { ret[i] = arrayList.get(i);//from ww w . ja v a 2 s.c o m } return ret; }
From source file:Main.java
/** * Print//from w w w . j a va 2 s . co m * */ public static void print(ArrayList<?> tokens) { for (int i = 0; i < tokens.size(); i++) { System.out.print(tokens.get(i) + " "); } System.out.print("\n"); System.out.print("\n"); }
From source file:Main.java
/** * Returns the wanted configuration as int array. * // w w w. ja va2 s . co m * @param configs * @return */ public static int[] getConfigArray(ArrayList<int[]> configs) { int[] result = new int[configs.size() * 2]; int index = 0; for (int[] val : configs) { result[index++] = val[0]; result[index++] = val[1]; } return result; }
From source file:Main.java
public static int indexOf(ArrayList<String> list, String value) { for (int i = 0; i < list.size(); i++) { String name = list.get(i); if (value.equals(name)) { return i; }/*from w w w.j a va2 s . c o m*/ } return -1; }
From source file:Main.java
static byte[] getArray(ArrayList<Byte> arrayList) { byte[] array = new byte[arrayList.size()]; int i = 0;//from ww w . j a v a2 s. c om for (Byte value : arrayList) { array[i] = value.byteValue(); i++; } return array; }
From source file:Main.java
/** * @param list An ArrayList to be expanded. * @param newCapacity The new capacity.//from w ww . j a v a 2 s. co m */ public static void expandArrayListSize(final ArrayList<?> list, final int newCapacity) { while (list.size() < newCapacity) { list.add(null); } }