Package com.reportmill.base
Class RMListUtils
java.lang.Object
com.reportmill.base.RMListUtils
Utility methods for use with Java.util.List.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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- 
RMListUtilspublic RMListUtils()
 
- 
- 
Method Details- 
sizeReturns the size of a list (accepts null list).
- 
getReturns the object at the given index (returns null object for null list or invalid index).
- 
getLastReturns the last object in the given list.
- 
containsReturns whehter list contains given object (accepts null list).
- 
containsIdenticalReturns whehter list contains indentical given object (accepts null list).
- 
indexOfIdenticalReturns index of identical given object in given list.
- 
addAdds an object to the given list and returns list (creates list if missing).
- 
addIfAbsentAdds an object to the given list if object is absent (creates list if missing).
- 
addIfAbsentIdenticalAdds an object to the given list if identical object is missing (creates list if missing).
- 
addAllAdds all object from second list to first list (creates first list if missing).
- 
removeRemoves given object from given list (accepts null list).
- 
removeRemoves range of objects from given list (from start to end, not including end).
- 
removeLastRemoves the last object from given list.
- 
removeIdenticalRemoves the object identical to the given object from list.
- 
removeAllIdenticalRemoves from aList all objects that are common to both lists.
- 
moveMoves the object at index 1 to index 2.
- 
reverseReverses the items in the given list.
- 
getFirstLeafReturns the first non-list object in the given list hierarchy, recursing if a list is found.
- 
objectsAtLevelReturns the objects at a given level in the given list hierarchy.
- 
countAtLevelReturns the number of objects at a given level in the given list hierarchy.
- 
joinStringsReturns a string by concatenating strings in given list separated by given string.
- 
newListCreates a new list containing the given object.
- 
newListCreates a new list containing the objects in the object array.
- 
newVectorCreates a new Vector for the given object.
- 
newVectorCreates a new vector for the given array of objects.
- 
xorAdds object from list 2 to list 1, unless they are already present (then removes them).
- 
objectsHaveSameClassReturns whether objects in list all have same class.
- 
moveToFrontMoves the object at the given index to the front of the list.
- 
moveToFrontMove the given object to the front of the list.
- 
cloneReturns a copy of the given list.
- 
cloneDeepReturns a copy of the given list with copies of all its items (recursively).
 
-