Iterable Immutable List Assignment

From CSE425S Wiki
Jump to navigation Jump to search

Code To Implement

Lists

class: Lists.java Java.png
methods: nil
cons
brackets
package: immutable.list.assignment
source folder: src/main/java

nil

public static <E> ImmutableList<E> nil()

Analogous to the SML List nil constructor.

cons

public static <E> ImmutableList<E> cons(E head, ImmutableList<E> tail)

brackets

@SafeVarargs
public static <E> ImmutableList<E> brackets(E... elements)

DefaultImmutableList

class: DefaultImmutableList.java Java.png
methods: head
tail
isEmpty
iterator
package: immutable.list.assignment
source folder: src/main/java

default constructor

head and tail constructor

head

tail

isEmpty

iterator

Test

class: ListsTestSuite.java Junit.png
package: immutable.list.assignment
source folder: src/test/java