Difference between revisions of "Iterable Immutable List Assignment"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
=Code To Revisit= | =Code To Revisit= | ||
− | + | In this studio we will complete the <code>DefaultImmutableList</code> implementation from the [[ImmutableList_Assignment|ImmutableList studio]]. | |
− | [[ImmutableList_Assignment]] | ||
=References= | =References= |
Revision as of 16:30, 24 April 2020
Contents
Code To Revisit
In this studio we will complete the DefaultImmutableList
implementation from the ImmutableList studio.
References
Iterable
Iterator
ImmutableList
public interface ImmutableList<E> extends Iterable<E> { E head(); ImmutableList<E> tail(); boolean isEmpty(); }
Code To Implement
DefaultImmutableList
class: | DefaultImmutableList.java | |
methods: | iterator | |
package: | immutable.list.assignment | |
source folder: | src/main/java |
iterator
public Iterator<E> iterator()
Example
class: | ListsExample.java | |
package: | immutable.list.example | |
source folder: | src/main/java |
The code:
ImmutableList<Integer> numbers = Lists.brackets(4, 66, 99); for (int i : numbers) { System.out.println(i); }
produces:
4 66 99
Test
class: | IterableAssignmentTestSuite.java | |
package: | immutable.list.assignment | |
source folder: | src/test/java |