Package com.reportmill.base
Class RMListUtils
java.lang.Object
com.reportmill.base.RMListUtils
Utility methods for use with Java.util.List.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ListAdds an object to the given list and returns list (creates list if missing).static ListAdds all object from second list to first list (creates first list if missing).static ListaddIfAbsent(List aList, Object anObj) Adds an object to the given list if object is absent (creates list if missing).static ListaddIfAbsentIdentical(List aList, Object anObj) Adds an object to the given list if identical object is missing (creates list if missing).static ListReturns a copy of the given list.static ListReturns a copy of the given list with copies of all its items (recursively).static booleanReturns whehter list contains given object (accepts null list).static booleancontainsIdentical(List aList, Object anObj) Returns whehter list contains indentical given object (accepts null list).static intcountAtLevel(List aList, int aLevel) Returns the number of objects at a given level in the given list hierarchy.static ObjectReturns the object at the given index (returns null object for null list or invalid index).static ObjectgetFirstLeaf(List aList) Returns the first non-list object in the given list hierarchy, recursing if a list is found.static ObjectReturns the last object in the given list.static intindexOfIdentical(List aList, Object anObj) Returns index of identical given object in given list.static StringjoinStrings(List aList, String aString) Returns a string by concatenating strings in given list separated by given string.static voidMoves the object at index 1 to index 2.static voidmoveToFront(List l, int i) Moves the object at the given index to the front of the list.static voidmoveToFront(List l, Object o) Move the given object to the front of the list.static ListCreates a new list containing the given object.static ListCreates a new list containing the objects in the object array.static VectorCreates a new Vector for the given object.static VectorCreates a new vector for the given array of objects.static ListobjectsAtLevel(List aList, int aLevel) Returns the objects at a given level in the given list hierarchy.static booleanReturns whether objects in list all have same class.static voidRemoves range of objects from given list (from start to end, not including end).static voidRemoves given object from given list (accepts null list).static voidremoveAllIdentical(List aList, List bList) Removes from aList all objects that are common to both lists.static voidremoveIdentical(List aList, Object anObj) Removes the object identical to the given object from list.static voidremoveLast(List aList) Removes the last object from given list.static ListReverses the items in the given list.static intReturns the size of a list (accepts null list).static voidAdds object from list 2 to list 1, unless they are already present (then removes them).
-
Constructor Details
-
RMListUtils
public RMListUtils()
-
-
Method Details
-
size
Returns the size of a list (accepts null list). -
get
Returns the object at the given index (returns null object for null list or invalid index). -
getLast
Returns the last object in the given list. -
contains
Returns whehter list contains given object (accepts null list). -
containsIdentical
Returns whehter list contains indentical given object (accepts null list). -
indexOfIdentical
Returns index of identical given object in given list. -
add
Adds an object to the given list and returns list (creates list if missing). -
addIfAbsent
Adds an object to the given list if object is absent (creates list if missing). -
addIfAbsentIdentical
Adds an object to the given list if identical object is missing (creates list if missing). -
addAll
Adds all object from second list to first list (creates first list if missing). -
remove
Removes given object from given list (accepts null list). -
remove
Removes range of objects from given list (from start to end, not including end). -
removeLast
Removes the last object from given list. -
removeIdentical
Removes the object identical to the given object from list. -
removeAllIdentical
Removes from aList all objects that are common to both lists. -
move
Moves the object at index 1 to index 2. -
reverse
Reverses the items in the given list. -
getFirstLeaf
Returns the first non-list object in the given list hierarchy, recursing if a list is found. -
objectsAtLevel
Returns the objects at a given level in the given list hierarchy. -
countAtLevel
Returns the number of objects at a given level in the given list hierarchy. -
joinStrings
Returns a string by concatenating strings in given list separated by given string. -
newList
Creates a new list containing the given object. -
newList
Creates a new list containing the objects in the object array. -
newVector
Creates a new Vector for the given object. -
newVector
Creates a new vector for the given array of objects. -
xor
Adds object from list 2 to list 1, unless they are already present (then removes them). -
objectsHaveSameClass
Returns whether objects in list all have same class. -
moveToFront
Moves the object at the given index to the front of the list. -
moveToFront
Move the given object to the front of the list. -
clone
Returns a copy of the given list. -
cloneDeep
Returns a copy of the given list with copies of all its items (recursively).
-