com.atlassian.jira.util
Class CollectionReorderer<T>
java.lang.Object
com.atlassian.jira.util.CollectionReorderer<T>
public class CollectionReorderer<T>
- extends Object
Method Summary |
void |
decreasePosition(List<T> objects,
T toMove)
|
void |
increasePosition(List<T> objects,
T toMove)
|
void |
moveToEnd(List<T> objects,
T toMove)
|
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 |
void |
moveToPosition(List<T> objects,
Map<Integer,T> positionToObjects)
Moves multiple objects in the objects list to given destination indexes |
void |
moveToPositionAfter(List<T> objects,
T toMove,
T target)
Move the 'toMove' to the position after the 'target'. |
void |
moveToStart(List<T> objects,
T toMove)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollectionReorderer
public CollectionReorderer()
moveToStart
public void moveToStart(List<T> objects,
T toMove)
moveToEnd
public void moveToEnd(List<T> objects,
T toMove)
decreasePosition
public void decreasePosition(List<T> objects,
T toMove)
increasePosition
public void increasePosition(List<T> objects,
T toMove)
moveToPositionAfter
public 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 intoMove
- the object to movetarget
- the position to move to
moveToPosition
public 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 objectspositionToObjects
- a naturally sorted map with destination indexes as keys
and the objects to move as values
moveToPosition
public 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 modifyinitialPosition
- the current index of the object that should be moved in the objects listtargetPosition
- the destination index
Copyright © 2002-2014 Atlassian. All Rights Reserved.