List of utility methods to do List Move Item
void | moveDownItems(List move Down Items for (int i = positions.length - 1; i >= 0; i--) { moveDownItem(list, positions[i]); |
Object | moveElementInList(List Moves the object at the source index of the list to the _target index of the list and returns the moved object. if (targetIndex >= list.size() || targetIndex < 0) throw new IndexOutOfBoundsException("targetIndex=" + targetIndex + ", size=" + list.size()); if (sourceIndex >= list.size() || sourceIndex < 0) throw new IndexOutOfBoundsException("sourceIndex=" + sourceIndex + ", size=" + list.size()); Object object = list.get(sourceIndex); if (targetIndex != sourceIndex) { list.remove(sourceIndex); list.add(targetIndex, object); ... |
List | moveElementToIndex(List move Element To Index assertObjectNotNull("list", list); final int fromIndex = list.indexOf(fromElement); final int toIndex = list.indexOf(toElement); return moveElementToIndex(list, fromIndex, toIndex); |
boolean | moveInList(List Move the element of the list from its current location to the specified index. boolean moved = list.remove(listItem); if (moved) { list.add(index, listItem); return moved; |
void | moveItem(List list, Object oldItem, int newIndex) move Item if ((list == null) || (list.isEmpty())) { return; int index = list.indexOf(oldItem); if (index == -1) { return; list.remove(index); ... |
List | moveItemIdInSecond(final List move Item Id In Second final boolean noItemKind = moveItemKindInFirst(list); if (list.contains("dmap.itemid")) { if (list.size() > 1) { list.remove("dmap.itemid"); int index = 1; if (noItemKind) { index = 0; list.add(index, "dmap.itemid"); return list; |
int[] | moveItems(List list, int[] indices, int moveby, boolean up) moves the selected items by a certain amount of items in a given direction. int i; int newIndex; if (up) { for (i = 0; i < indices.length; i++) { if (indices[i] == 0) continue; newIndex = indices[i] - moveby; swap(list, indices[i], newIndex); ... |
List | moveLeft(int offset, T element, List This method returns a new List instance containing the same element objects as the provided list, but with the specified element having been moved left by the specified offset. return moveRight(-offset, element, list);
|
List | moveOnePositionUp(final List Move one position up. return changePosition(list, object, -1);
|
List | moveRight(int offset, T element, List This method does the same as #moveLeft(int,Object,List) but it moves the specified element to the right instead of the left. final int elementIndex = list.indexOf(element); if (elementIndex == -1) { throw new NoSuchElementException("Element not found in provided list."); if (offset == 0) { return list; } else { int newElementIndex = elementIndex + offset; ... |