List of utility methods to do List First Item
List | mergePreserveOrder(List merge Preserve Order List<String> out = new ArrayList<>(); int i = 0; int j = 0; while (i < first.size() || j < second.size()) { while (i < first.size() && j < second.size() && first.get(i).equals(second.get(j))) { out.add(first.get(i)); i++; j++; ... |
boolean | moveItemKindInFirst(final List move Item Kind In First boolean noItemKind = true; if (list.contains("dmap.itemkind")) { list.remove("dmap.itemkind"); list.add(0, "dmap.itemkind"); noItemKind = false; return noItemKind; |
List | nullSafeAppend(List This method joins two lists returning the a single list consisting of the first followed by the second. return nullSafeAppend(first, second, false);
|
List | orderByFirstOccurenceInText(String listToOrder[], String textToParse, boolean fuzzy) This function sorts the Strings in the given list by their first occurence in the given text. List<String> sortedList = new ArrayList<String>(); HashMap<Integer, String> h = new HashMap<Integer, String>(); if (listToOrder != null && !textToParse.equals("")) { for (String s : listToOrder) { if (textToParse.indexOf(s) > 0) { h.put(textToParse.indexOf(s), s); List<Integer> keys = new ArrayList<Integer>(h.keySet()); Collections.sort(keys); for (Integer k : keys) { sortedList.add(h.get(k)); if (fuzzy) { sortedList.addAll(orderByFuzzyFirstOccurenceInText(listToOrder, textToParse)); return sortedList; |
List | orderByFuzzyFirstOccurenceInText(String listToOrder[], String textToParse) This function sorts the Strings in the given list by their first occurrence in the given text. List<String> sortedList = new ArrayList<String>(); HashMap<Integer, String> h = new HashMap<Integer, String>(); if (listToOrder != null && !textToParse.equals("")) { for (String stringTokens : listToOrder) { String[] tokens = stringTokens.split(" "); for (String token : tokens) { if (textToParse.indexOf(token) > 0 && token.length() > 3) { h.put(textToParse.indexOf(token), token); ... |
List
| permutationsWithFirstElement(List permutations With First Element List<T> list = new ArrayList<T>(listings); list.remove(0); List<List<T>> perms = permutations(list); for (List<T> l : perms) { l.add(listings.get(0)); list = new ArrayList<T>(); list.add(listings.get(0)); ... |
List | prepend(String first, List prepend return merge(Arrays.asList(first), list);
|
void | putFirstLast(List list) put First Last list.add(list.get(0)); list.remove(0); |
T | removeFirst(final List Removes the first object from the given List. if (!isEmpty(list) && 0 < list.size()) { return list.remove(0); return null; |
List | removeFirst(List remove First if (list != null && list.size() > 0) { List<T> newList = new ArrayList<T>(); for (int i = 1; i < list.size(); i++) { T t = list.get(i); newList.add(t); return newList; } else { ... |