Class ListUtils

java.lang.Object
nz.org.riskscape.util.ListUtils

public class ListUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> List<T>
    append(List<? extends T> list, T element)
    Fluid, immutable list appending method that appends an element at the end of a given list, returning a new list
    static <T> List<T>
    concat(List<? extends T> list1, List<? extends T> list2)
    Fluid, immutable list concatenation method that concatenates two lists, returning a new list with the contents of list1 and list2 appended in order.
    static <T> List<T>
    prepend(T element, List<? extends T> list)
    Fluid, immutable list prepending method that prepends the given element to the given list, returning a new list
    static <T> List<T>
    prepend(T element, T... rest)
    Fluid, immutable list prepending method that prepends the given element to the given list, returning a new list

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ListUtils

      public ListUtils()
  • Method Details

    • concat

      public static <T> List<T> concat(List<? extends T> list1, List<? extends T> list2)

      Fluid, immutable list concatenation method that concatenates two lists, returning a new list with the contents of list1 and list2 appended in order.

    • append

      public static <T> List<T> append(List<? extends T> list, T element)

      Fluid, immutable list appending method that appends an element at the end of a given list, returning a new list

    • prepend

      public static <T> List<T> prepend(T element, List<? extends T> list)

      Fluid, immutable list prepending method that prepends the given element to the given list, returning a new list

    • prepend

      @SafeVarargs public static <T> List<T> prepend(@NonNull T element, T... rest)

      Fluid, immutable list prepending method that prepends the given element to the given list, returning a new list