List of usage examples for java.util List get
E get(int index);
From source file:Main.java
public static String implode(String glue, List<String> listArr) { String ret = ""; for (int i = 0; i < listArr.size(); i++) { ret += (i == listArr.size() - 1) ? listArr.get(i) : listArr.get(i) + glue; }/*from www . j ava 2 s .c om*/ return ret; }
From source file:Main.java
public static byte[] byteMergerList(List<byte[]> list) { byte[] temp = new byte[0]; for (int i = 0; i < list.size(); i++) { temp = byteMerger(temp, list.get(i)); }/*from www . j av a 2 s. co m*/ return temp; }
From source file:Main.java
public static String[] toArray(List<String> list) { String[] strings = new String[list.size()]; for (int i = 0; i < list.size(); i++) { strings[i] = list.get(i); }// w w w. ja va 2 s. c om return strings; }
From source file:Main.java
public static int[] getExtremeCoords(List<int[]> positions, boolean min) { if (positions.size() > 0) { int[] selectedPos = positions.get(0).clone(); for (int n = 1; n < positions.size(); n++) { int[] position = positions.get(n); for (int i = 0; i < selectedPos.length; i++) { selectedPos[i] = min ? Math.min(position[i], selectedPos[i]) : Math.max(position[i], selectedPos[i]); }//ww w.ja v a 2 s . c om } return selectedPos; } return null; }
From source file:Main.java
public static Element getFirstElementByTagName(final Element parent, final String tagName) { List<Element> foundElements = getNamedChildElements(parent, tagName); if (foundElements.size() > 0) { return foundElements.get(0); } else {//from www. jav a2 s . c o m return null; } }
From source file:Main.java
public static String getTopActivity(Context context) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> runningTaskInfos = manager.getRunningTasks(1); if (runningTaskInfos != null) return runningTaskInfos.get(0).topActivity.getClassName(); else//from w w w .j a va 2 s.co m return ""; }
From source file:Main.java
public static String seek(List<String> strings1, List<String> strings2, String content) { int idx = strings1.indexOf(content); if (idx == -1) return null; return strings2.get(idx); }
From source file:Main.java
public static Element getFirstElementByTagName(Element parent, String tagName) { List<Element> foundElements = getNamedChildElements(parent, tagName); if (foundElements.size() > 0) { return foundElements.get(0); } else {//from w ww . j av a2 s . c o m return null; } }
From source file:Main.java
public static String breakList(String divider, List<String> list) { String result = ""; for (int i = 0; i < list.size(); ++i) { String val = (String) list.get(i); if (!val.isEmpty()) { result = result + val + (i == list.size() - 1 ? "" : divider); }//from w w w . j a v a2 s . com } return result; }
From source file:Main.java
public static boolean isAppRunningForeground(Context context) { ActivityManager var1 = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List list = var1.getRunningTasks(1); return context.getPackageName() .equalsIgnoreCase(((ActivityManager.RunningTaskInfo) list.get(0)).baseActivity.getPackageName()); }