List of utility methods to do List Null Empty
List | getEmptyList(Class get Empty List return Collections.unmodifiableList(new ArrayList<T>(0)); |
T | getIgnoreNull(List get Ignore Null int cnt = 0; for (T i : list) if (i != null) { if (cnt == n) return i; cnt++; return null; ... |
List | getListIgnoringNulls(T[] items) get List Ignoring Nulls if (items == null) { return null; List<T> results = new ArrayList<T>(); for (T next : items) { if (next != null) { results.add(next); if (results.size() == 0) { return null; return results; |
List | getNonNull(List get Non Null if (list == null) { return Collections.emptyList(); return list; |
int | getNotNullCount(List> list) get Not Null Count if (list == null) { return 0; int count = 0; for (Object obj : list) { if (obj != null) { count++; return count; |
List | getNotNullId(final List get Not Null Id List<Long> result = new ArrayList<Long>(); if (idList == null || idList.isEmpty()) return result; for (Long id : idList) if (id != null) result.add(id); return result; |
String | getScreen_BL_NONNULL(List get ScreeBNONNULL return getHTML_BL(searchableFields);
|
List | getSearchTermIndexLocationsOrNull(final List get Search Term Index Locations Or Null String[] tokanizedSearchTerm = getTokanizedSearchTerm(searchTerm.toUpperCase()); List<Integer> indexLocations = new ArrayList<Integer>(); for (int i = 0; i < pageWords.size(); i++) { for (String token : tokanizedSearchTerm) { if (token.equals(pageWords.get(i))) { indexLocations.add(i); return indexLocations; |
List | getStringAsList(String input, String regexSplitter, boolean ignoreEmptyTokens) get String As List List<String> results = new ArrayList<String>(); if (input == null) { return results; for (String lineItem : input.split(regexSplitter)) { if (ignoreEmptyTokens && lineItem.trim().equals("")) { continue; results.add(lineItem); return results; |
List | immutableListOfType(List immutable List Of Type List<Object> l = new ArrayList<Object>(list.size()); for (Iterator iter = list.iterator(); iter.hasNext();) { Object item = iter.next(); if (item == null) { if (!nullOk) { throw new NullPointerException("item of list is null"); } else if (!type.isInstance(item)) { ... |