Difference between revisions of "Iterable Immutable List Assignment"
Jump to navigation
Jump to search
(→nil) |
|||
Line 4: | Line 4: | ||
===nil=== | ===nil=== | ||
<nowiki>public static <E> ImmutableList<E> nil()</nowiki> | <nowiki>public static <E> ImmutableList<E> nil()</nowiki> | ||
+ | |||
+ | Analogous to the [http://sml-family.org/Basis/list.html SML List] [http://sml-family.org/Basis/list.html#SIG:LIST.nil:TY nil constructor]. | ||
+ | |||
===cons=== | ===cons=== | ||
<nowiki>public static <E> ImmutableList<E> cons(E head, ImmutableList<E> tail)</nowiki> | <nowiki>public static <E> ImmutableList<E> cons(E head, ImmutableList<E> tail)</nowiki> |
Revision as of 15:28, 30 July 2019
Contents
Code To Implement
Lists
class: | Lists.java | |
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 | |
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 | |
package: | immutable.list.assignment | |
source folder: | src/test/java |