List of utility methods to do List First Item
Object | getFirstInstanceOf(List source, String className) get First Instance Of Class targetInstance = Class.forName(className); if (findInstanceOfClassExists(source, className)) { for (Object object : source) { if (targetInstance.isInstance(object)) return targetInstance.cast(object); return null; ... |
String | getFirstItemOrNull(List get First Item Or Null return items == null || items.size() == 0 ? null : items.get(0);
|
Object | getFirstLeaf(List aList) Returns the first non-list object in the given list hierarchy, recursing if a list is found. for (int i = 0, iMax = aList.size(); i < iMax; i++) { Object obj = aList.get(i); if (obj instanceof List) obj = getFirstLeaf((List) obj); if (obj != null) return obj; return null; ... |
int | getFirstNameIndex(List get First Name Index for (int i = 0; i < list.size(); i++) { if ((list.get(i).length() > 1) && (!personStopWordSet.contains(list.get(i)))) { return i; return -1; |
int | getFirstNonEmptyIndex(final List get First Non Empty Index for (int i = 0; i < list.size(); i++) { final Collection<?> o = list.get(i); if (o != null && !o.isEmpty()) { return i; return -1; |
String | getFirstObject(List Get the String value Stored on the 0 index of specified List. try { return valueList.get(0).toString(); } catch (Exception e) { return null; |
String | getFirstOccurNic(List get First Occur Nic int idx = Integer.MAX_VALUE; String result = ""; for (String nic : nics) { int i = line.indexOf(nic); if ((i >= 0) && (i < idx)) { idx = i; result = nic; return result; |
T | getFirstOrNull(List get First Or Null return elements.isEmpty() ? null : elements.get(0);
|
T | getFirstOrNull(List Return the first element of list. if (list == null || list.isEmpty()) { return null; return list.get(0); |
T[] | getFirstRowMatch(List get First Row Match for (T[] rows : list) { if (rows[columnIndex].equals(value)) return rows; return null; |