public class

CollectionReorderer

extends Object
java.lang.Object
   ↳ com.atlassian.jira.util.CollectionReorderer

Summary

Public Methods
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)
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static void decreasePosition (List<T> objects, T toMove)

public static void increasePosition (List<T> objects, T toMove)

public static void moveToEnd (List<T> objects, T toMove)

public static 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

Parameters
objects the list of objects to modify
initialPosition the current index of the object that should be moved in the objects list
targetPosition the destination index

public static void moveToPosition (List<T> objects, Map<Integer, T> positionToObjects)

Moves multiple objects in the objects list to given destination indexes

Parameters
objects the list of objects
positionToObjects a naturally sorted map with destination indexes as keys and the objects to move as values

public static void moveToPositionAfter (List<T> objects, T toMove, T target)

Move the 'toMove' to the position after the 'target'. To insert to the head of the list set afterThis to null

Parameters
objects list of objects to look up and order in
toMove the object to move
target the position to move to

public static void moveToStart (List<T> objects, T toMove)