Package com.inductiveautomation.rm.base
Class RMListUtils
java.lang.Object
com.inductiveautomation.rm.base.RMListUtils
Utility methods for use with Java.util.List.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> List<T>Adds an object to the given list and returns list (creates list if missing).static <T> List<T>addAllUnique(List<T> aList, int anIndex, T... theObjects) Adds all object from second list to first list (creates first list if missing).static <T> List<T>addAllUnique(List<T> aList, List<T> theObjects) Adds all object from second list to first list (creates first list if missing).static <T> List<T>addAllUnique(List<T> aList, T... theObjects) Adds all object from second list to first list (creates first list if missing).static <T> List<T>addAllUniqueId(List<T> aList, List<T> theObjects) Adds all object from second list to first list (creates first list if missing).static <T> List<T>addAllUniqueId(List<T> aList, T... theObjects) Adds all object from second list to first list (creates first list if missing).static <T> List<T>Adds an object to the given list if object is absent (creates list if missing).static <T> List<T>addUniqueId(List<T> aList, T anObj) Adds an object to the given list if identical object is missing (creates list if missing).static <T> intbinarySearch(List<? extends Comparable<? super T>> aList, T aKey) Returns the result of binary search, but always returns insert index.static <T> List<T>Returns a copy of the given list.static <T> List<T>Returns a copy of the given list with copies of all its items (recursively).static booleanReturns whether list contains given object (accepts null list).static booleancontainsId(List aList, Object anObj) Returns whether list contains identical 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 booleanReturns whether lists have same objects in them.static voidFilters a given list in place with the given key chain string.static <T> TReturns the object at the given index (returns null object for null list or invalid index).static ListgetFilteredList(List aList, String aKeyChain) Returns a filtered list (copy with given key chain string.static ObjectgetFirstLeaf(List aList) Returns the first non-list object in the given list hierarchy, recursing if a list is found.static int[]getIndexesId(List aList, List aSubList) Returns an array of indexes for given list and given objects in list.static <T> TReturns the last object in the given list.static <T> TgetMatch(Collection<T> aCollection, String aKeyChain, Object aValue) Returns the matching object for this given key value.static <T> List<T>getMatches(Collection<T> aCollection, String aKeyChain, Object aValue) Returns the matching object for this given key value.static intgetMatchIndex(List aList, String aKeyChain, Object aValue) Returns the matching index for this given key value.static intReturns 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 aList, int anIndex) Moves the object at the given index to the front of the list.static voidmoveToFront(List aList, Object anObj) Move the given object to the front of the list.static <T> List<T>newArrayList(int aCapacity, T anObj) Creates a new array list with given object and capacity.static <T> List<T>newArrayList(int aCapacity, T... theObjects) Creates a new array list with given objects and capacity.static <T> List<T>newArrayList(T anObj) Creates a new array list with given object.static <T> List<T>newArrayList(T... theObjects) Creates a new array list with given objects.static <T> List<T>newList(T... objects) Creates a new list containing the objects in the object array.static <T> Vector<T>newVector(T... objects) Creates 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 booleanRemoves given object from given list (accepts null list).static intRemoves the object identical to the given object from list.static <T> TremoveLast(List<T> 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 <T> T[]Returns an array of object of given class.static <T> List<T>Converts an iterable to list.static <T> List<T>toList(Enumeration<T> anEnumeration) Converts an enumeration to a 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 whether list contains given object (accepts null list).
- 
containsIdReturns whether list contains identical given object (accepts null list).
- 
indexOfIdReturns index of identical given object in given list.
- 
getIndexesIdReturns an array of indexes for given list and given objects in list.
- 
addAdds an object to the given list and returns list (creates list if missing).
- 
addUniqueAdds an object to the given list if object is absent (creates list if missing).
- 
addUniqueIdAdds an object to the given list if identical object is missing (creates list if missing).
- 
addAllUniqueAdds all object from second list to first list (creates first list if missing).
- 
addAllUniqueIdAdds all object from second list to first list (creates first list if missing).
- 
addAllUniqueAdds all object from second list to first list (creates first list if missing).
- 
addAllUniqueAdds all object from second list to first list (creates first list if missing).
- 
addAllUniqueIdAdds 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.
- 
removeIdRemoves the object identical to the given object from list.
- 
binarySearchReturns the result of binary search, but always returns insert index.
- 
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.
- 
toArrayReturns an array of object of given class.
- 
newArrayListCreates a new array list with given object.
- 
newArrayListCreates a new array list with given object and capacity.
- 
newArrayListCreates a new array list with given objects.
- 
newArrayListCreates a new array list with given objects and capacity.
- 
newListCreates a new list containing the objects in the object array.
- 
newVectorCreates a new vector for the given array of objects.
- 
toListConverts an iterable to list.
- 
toListConverts an enumeration to a list.
- 
xorAdds object from list 2 to list 1, unless they are already present (then removes them).
- 
getMatchReturns the matching object for this given key value.
- 
getMatchesReturns the matching object for this given key value.
- 
getMatchIndexReturns the matching index for this given key value.
- 
filterFilters a given list in place with the given key chain string.
- 
getFilteredListReturns a filtered list (copy with given key chain string.
- 
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.
- 
equalsIdReturns whether lists have same objects in them.
- 
cloneReturns a copy of the given list.
- 
cloneDeepReturns a copy of the given list with copies of all its items (recursively).
 
-