Class Lists

java.lang.Object
immutable.list.assignment.Lists

public class Lists
extends java.lang.Object
Author:
__STUDENT_NAME__, Dennis Cosgrove (http://www.cse.wustl.edu/~cosgroved/)
  • Constructor Summary

    Constructors 
    Constructor Description
    Lists()  
  • Method Summary

    Modifier and Type Method Description
    static <E> ImmutableList<E> brackets​(E... elements)  
    static <E> ImmutableList<E> cons​(E head, ImmutableList<E> tail)
    Constructs a new list comprised of head and tail.
    static <E> ImmutableList<E> nil()  

    Methods inherited from class java.lang.Object

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

  • Method Details

    • nil

      public static <E> ImmutableList<E> nil()
      Type Parameters:
      E - the type of elements held in the ImmutableList
      Returns:
      an empty ImmutableList
    • cons

      public static <E> ImmutableList<E> cons​(E head, ImmutableList<E> tail)
      Constructs a new list comprised of head and tail.
      Type Parameters:
      E - the type of elements held in the ImmutableLists
      Parameters:
      head - the value
      tail - the rest
      Returns:
      the constructed list
    • brackets

      @SafeVarargs public static <E> ImmutableList<E> brackets​(E... elements)
      Type Parameters:
      E - the type of elements held in the ImmutableList
      Parameters:
      elements - the contents of the to be created list
      Returns:
      the created list