|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ge.research.utils.CollectionUtils
com.ge.research.utils.ListUtils
A utility class with common, useful methods for dealing with Lists.
| Constructor Summary | |
ListUtils()
|
|
| Method Summary | |
static boolean |
allElementsOfType(java.util.List list,
java.lang.Class type)
Checks each entry in the List to see if the entry is assignable to the argument class type. |
static boolean |
isInRange(java.util.List list,
int index)
Checks the argument index against the List to see if it is a valid index reference for the List. |
static void |
moveItem(java.util.List list,
int moveFrom,
int moveTo)
Moves the element in the list list from the position moveFrom to
the position moveTo, and preserves the order of the list. |
static void |
moveItem(java.util.List list,
java.lang.Object element,
int moveTo)
Moves the element in the list |
static void |
moveItemAfter(java.util.List list,
java.lang.Object elementToMove,
java.lang.Object referenceElement)
Moves the elementToMove and places it directly after the
referenceElement in the list, and preserves the order of the list. |
static void |
moveItemBefore(java.util.List list,
java.lang.Object elementToMove,
java.lang.Object referenceElement)
Moves the elementToMove and places it directly before the
referenceElement in the list, and preserves the order of the list. |
static void |
moveItemToEnd(java.util.List list,
int moveFrom)
Moves the element in the list currently at position moveFrom
to the end of the list, and preserves the order of the list. |
static void |
moveItemToEnd(java.util.List list,
java.lang.Object element)
Moves the element in the list
to the end of the list, and preserves the order of the list. |
static void |
moveItemToStart(java.util.List list,
int moveFrom)
Moves the element in the list currently at position moveFrom
to the beginning of the list, and preserves the order of the list. |
static void |
moveItemToStart(java.util.List list,
java.lang.Object element)
Moves the element in the list
to the beginning of the list, and preserves the order of the list. |
static void |
swapItems(java.util.List list,
java.lang.Object elementOne,
java.lang.Object elementTwo)
Moves two elements of the list such that each element occupies the others original position. |
| Methods inherited from class com.ge.research.utils.CollectionUtils |
allElementsOfType, moveItem, moveItem, moveItemAfter, moveItemBefore, moveItemToEnd, moveItemToEnd, moveItemToStart, moveItemToStart, orderItems, removeDuplicates, reverseOrder, swapItems |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ListUtils()
| Method Detail |
public static boolean allElementsOfType(java.util.List list,
java.lang.Class type)
List to see if the entry is assignable to the argument class type.
list - the datastructure that implements the List interface and contains the elements of interesttype - the Class type to check each entry in the List against, to see if the entries are an instance of that class or one of its subclasses.
true if all entries are of the type specified, or if the List is null or empty;
false otherwise
public static boolean isInRange(java.util.List list,
int index)
index against the List to see if it is a valid index reference for the List.
list - the datastructure that implements the List interface and contains the elements of interestindex - the index value to check against the size of the List to see if it is a valid index reference
false if the List is null, or if the List is empty, or if index is negative, or if index is greater than or equal to the size of the List;
true otherwise
public static void moveItem(java.util.List list,
int moveFrom,
int moveTo)
moveFrom to
the position moveTo, and preserves the order of the list.
list - the datastructure that implements the List interface and contains the elements of interestmoveFrom - the index within the list the element to move currently resides atmoveTo - the index within the list the element is to be moved to
public static void moveItem(java.util.List list,
java.lang.Object element,
int moveTo)
element in the list from its current position to
the position moveTo, and preserves the order of the list.
- Parameters:
list - the datastructure that implements the List interface and contains the elements of interestelement - the list element to movemoveTo - the index within the list the element is to be moved to- See Also:
moveItem(java.util.List, int, int)
public static void moveItemAfter(java.util.List list,
java.lang.Object elementToMove,
java.lang.Object referenceElement)
elementToMove and places it directly after the
referenceElement in the list, and preserves the order of the list.
list - the datastructure that implements the List interface and contains the elements of interestelementToMove - the element to movereferenceElement - the element that marks the position within the list that the moving element should immediately followmoveItem(java.util.List, int, int)
public static void moveItemBefore(java.util.List list,
java.lang.Object elementToMove,
java.lang.Object referenceElement)
elementToMove and places it directly before the
referenceElement in the list, and preserves the order of the list.
list - the datastructure that implements the List interface and contains the elements of interestelementToMove - the element to movereferenceElement - the element that marks the position within the list that the moving element should immediately precedemoveItem(java.util.List, int, int)
public static void moveItemToEnd(java.util.List list,
int moveFrom)
list currently at position moveFrom
to the end of the list, and preserves the order of the list.
list - the datastructure that implements the List interface and contains the elements of interestmoveFrom - the index within the list the element to move currently resides atmoveItem(java.util.List, int, int)
public static void moveItemToEnd(java.util.List list,
java.lang.Object element)
element in the list
to the end of the list, and preserves the order of the list.
list - The datastructure that implements the List interface and contains the elements of interestelement - The element to move to the end of the listmoveItem(java.util.List, java.lang.Object, int)
public static void moveItemToStart(java.util.List list,
int moveFrom)
list currently at position moveFrom
to the beginning of the list, and preserves the order of the list.
list - the datastructure that implements the List interface and contains the elements of interestmoveFrom - the index within the list the element to move currently resides atmoveItem(java.util.List, int, int)
public static void moveItemToStart(java.util.List list,
java.lang.Object element)
element in the list
to the beginning of the list, and preserves the order of the list.
list - the datastructure that implements the List interface and contains the elements of interestelement - the element to move to the beginning of the listmoveItem(java.util.List, java.lang.Object, int)
public static void swapItems(java.util.List list,
java.lang.Object elementOne,
java.lang.Object elementTwo)
list - the datastructure that implements the List interface and contains the elements of interestelementOne - the first element to move.
Its current position will be occupied by elementTwo after the swap is performedelementTwo - the second element to move
Its current position will be occupied by elementOne after the swap is performedmoveItem(java.util.List, java.lang.Object, int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||