List of usage examples for java.util List get
E get(int index);
From source file:Main.java
public static String[] toStringArray(List<String> input) { String[] retarr = new String[input.size()]; for (int i = 0; i < input.size(); i++) { retarr[i] = input.get(i); }/*from w w w . j av a2s . c o m*/ return retarr; }
From source file:Main.java
public static String getTopActivity(Context context) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningTaskInfo> runningTaskInfos = manager.getRunningTasks(1); if (runningTaskInfos != null) return runningTaskInfos.get(0).topActivity.getClassName(); else//from w w w. j a v a 2 s.c o m return ""; }
From source file:Main.java
public static <V extends Comparable<V>> V max(List<V> arg) { if (arg == null) { return null; }// w w w .ja v a 2 s. com if (arg.size() == 1) { return arg.get(0); } V max = arg.get(0); for (V each : arg) { if (max.compareTo(each) < 0) { max = each; } } return max; }
From source file:Main.java
public static byte[] fromByteArray(List<Byte> byteArray) { byte[] rval = new byte[byteArray.size()]; for (int i = 0; i < byteArray.size(); i++) { rval[i] = byteArray.get(i); }// w w w. j av a 2 s . co m return rval; }
From source file:Main.java
public static boolean isAvilible(Context context, String packageName) { PackageManager packageManager = context.getPackageManager(); List pinfo = packageManager.getInstalledPackages(0); for (int i = 0; i < pinfo.size(); ++i) { if (((PackageInfo) pinfo.get(i)).packageName.equalsIgnoreCase(packageName)) { return true; }// w w w . jav a 2 s . c om } return false; }
From source file:Main.java
public static void listSupportPreviewSize(Camera.Parameters parameters) { if (parameters == null) { return;/*from w ww .jav a 2 s . co m*/ } List<Camera.Size> list = parameters.getSupportedPreviewSizes(); for (int j = 0; j < list.size(); j++) { Camera.Size s = list.get(j); Log.i("CameraHelper", "support size : width=" + s.width + ",height=" + s.height); } }
From source file:Main.java
public static long[] toLongArray(final List<Long> arrList) { final long[] r = new long[arrList.size()]; for (int i = 0; i < arrList.size(); i++) { r[i] = arrList.get(i); }/* ww w . j a v a2 s . c o m*/ return r; }
From source file:com.saax.gestorweb.util.DAOAleatorio.java
public static CentroCusto getCentroCustoAleatorio(EntityManager em) { List<CentroCusto> centroCustos = em.createNamedQuery("CentroCusto.findAll").getResultList(); return centroCustos.get(new Random().nextInt(centroCustos.size() - 1)); }
From source file:Main.java
public static float getOffset(int from, int move, float progress, float startX, float oldStartX, List<Float> gaps, List<Float> oldGaps) { float dist = startX; for (int i = 0; i < move; i++) { dist += gaps.get(i); }/*from ww w. j av a 2 s .c om*/ float cur = oldStartX; for (int i = 0; i < from; i++) { cur += oldGaps.get(i); } return cur + (dist - cur) * progress; }
From source file:Main.java
public static Integer[] change2Array(List<Integer> list) { Integer[] result = new Integer[list.size()]; for (int k = 0; k < list.size(); k++) { result[k] = list.get(k); }/*from ww w. j a v a 2s . co m*/ return result; }