List of utility methods to do List Move Item
String | addRemoveChangeToString(int from, int to, List> list, List> removed) add Remove Change To String StringBuilder b = new StringBuilder(); if (removed.isEmpty()) { b.append(list.subList(from, to)); b.append(" added at ").append(from); } else { b.append(removed); if (from == to) { b.append(" removed at ").append(from); ... |
boolean | canMoveUp(List list, int[] indices) checks whether the selected items can be moved up. boolean result; result = false; if (indices.length > 0) { if (indices[0] > 0) result = true; return result; |
String | getLongestLine(String text, List get Longest Line String result = null; String toInvestigate = removeParts(text, partsToRemove); String longest = ""; String words[] = toInvestigate.split(separator); for (int i = 0; i < words.length; i++) { String word = words[i]; if (word.length() > longest.length()) { longest = word; ... |
List | getRemoveAll(List Return list1 - list2. Set<E> set1 = new LinkedHashSet<E>(list1); set1.removeAll(list2); return new ArrayList<E>(set1); |
List | minus(List minus List<T> minusedList = new ArrayList<T>(initialList); minusedList.removeAll(elementsToRemove); return minusedList; |
void | move(List aList, int anIndex1, int anIndex2) Moves the object at index 1 to index 2. if (anIndex1 < 0 || anIndex1 >= aList.size() || anIndex2 < 0 || anIndex2 >= aList.size()) return; Object obj = aList.remove(anIndex1); aList.add(anIndex2, obj); |
void | move(List> collection, int indexToMoveFrom, int indexToMoveAt) move if (indexToMoveAt >= indexToMoveFrom) { Collections.rotate(collection.subList(indexToMoveFrom, indexToMoveAt + 1), -1); } else { Collections.rotate(collection.subList(indexToMoveAt, indexToMoveFrom + 1), 1); |
boolean | moveBackward(final List Moves elements specified by their indices backward by 1. if (indices.length == 0) return false; Arrays.sort(indices); if (indices[0] == 0) return false; for (final int idx : indices) { final T element = list.get(idx); list.set(idx, list.get(idx - 1)); ... |
boolean | moveBefore(List Moves the given element before the reference element. int index = list.indexOf(referenceElement); if (index != -1) { list.remove(element); list.add(index, element); return true; return false; |
List | moved(List moved List<String> moved = null; List<String> compare = null; if (added != null) { for (String child : added) { if (compare == null) { compare = new ArrayList<String>(nu); compare.remove(child); ... |