public class CollectionReorderer extends Object
Modifier and Type | Method and Description |
---|---|
static <T> void |
decreasePosition(List<T> objects,
T toMove) |
static <T> void |
increasePosition(List<T> objects,
T toMove) |
static <T> void |
moveToEnd(List<T> objects,
T toMove) |
static <T> void |
moveToPosition(List<T> objects,
int initialPosition,
int targetPosition)
If moving more than one object at the same time please use
moveToPosition(java.util.List, java.util.Map)
Moves an object at initialPosition index in the objects list to the targetPosition index |
static <T> void |
moveToPosition(List<T> objects,
Map<Integer,T> positionToObjects)
Moves multiple objects in the objects list to given destination indexes
|
static <T> void |
moveToPositionAfter(List<T> objects,
T toMove,
T target)
Move the 'toMove' to the position after the 'target'.
|
static <T> void |
moveToStart(List<T> objects,
T toMove) |
public static <T> void moveToStart(List<T> objects, T toMove)
public static <T> void moveToEnd(List<T> objects, T toMove)
public static <T> void decreasePosition(List<T> objects, T toMove)
public static <T> void increasePosition(List<T> objects, T toMove)
public static <T> void moveToPositionAfter(List<T> objects, T toMove, T target)
objects
- list of objects to look up and order intoMove
- the object to movetarget
- the position to move topublic static <T> void moveToPosition(List<T> objects, Map<Integer,T> positionToObjects)
objects
- the list of objectspositionToObjects
- a naturally sorted map with destination indexes as keys
and the objects to move as valuespublic static <T> void moveToPosition(List<T> objects, int initialPosition, int targetPosition)
moveToPosition(java.util.List, java.util.Map)
Moves an object at initialPosition index in the objects list to the targetPosition index
objects
- the list of objects to modifyinitialPosition
- the current index of the object that should be moved in the objects listtargetPosition
- the destination indexCopyright © 2002-2016 Atlassian. All Rights Reserved.