Package ubic.gemma.core.util
Class ListUtils
- java.lang.Object
- 
- ubic.gemma.core.util.ListUtils
 
- 
- 
Constructor SummaryConstructors Constructor Description ListUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> List<List<T>>batch(List<T> list, int batchSize)static Map<String,Integer>indexOfCaseInsensitiveStringElements(List<String> list)Get a case-insensitive mapping of string elements to their first occurrence in aList.static <T> Map<T,Integer>indexOfElements(List<T> list)Get a mapping of element to their first occurrence in aList.static <T> List<T>pad(List<T> list, T elementForPadding, int size)Pad a collection with the given element.static <T> List<T>padToNextPowerOfTwo(List<T> list, T elementForPadding)Pad a collection to the next power of 2 with the given element.
 
- 
- 
- 
Method Detail- 
indexOfElementspublic static <T> Map<T,Integer> indexOfElements(List<T> list) Get a mapping of element to their first occurrence in aList. This of this as an efficient way of callingList.indexOf(Object)in a loop, since it will reduce the complexity to O(n) instead of O(n^2). I couldn't find this algorithm in Guava nor Apache Collections, but if you do, let me know!
 - 
indexOfCaseInsensitiveStringElementspublic static Map<String,Integer> indexOfCaseInsensitiveStringElements(List<String> list) Get a case-insensitive mapping of string elements to their first occurrence in aList.- See Also:
- indexOfElements(List)
 
 - 
padToNextPowerOfTwopublic static <T> List<T> padToNextPowerOfTwo(List<T> list, T elementForPadding) Pad a collection to the next power of 2 with the given element.
 - 
padpublic static <T> List<T> pad(List<T> list, T elementForPadding, int size) Pad a collection with the given element.
 
- 
 
-