Class ListUtils


  • public class ListUtils
    extends Object
    • Constructor Detail

      • ListUtils

        public ListUtils()
    • Method Detail

      • getOrNull

        public static <T> T getOrNull​(List<T> list,
                                      int i)
        Return the item at index or null if it does not exist. Checks the size of the list before accessing the item (hence, the complexity of size() is ideally O(1)) Argument must not be negative
        Parameters:
        list -
        i -
        Returns:
      • getOrDefault

        public static <T> T getOrDefault​(List<T> list,
                                         int i,
                                         T dflt)