Difference between revisions of "ImmutableList Assignment"

From CSE425S Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
=Code To Implement=
 
=Code To Implement=
 +
class DefaultImmutableList implements [https://www.cse.wustl.edu/~cosgroved/courses/cse425s/spring20/apidocs/immutable/list/core/ImmutableList.html ImmutableList<E>]
 +
 
==Length==
 
==Length==
 
{{JavaToImplement|Length|length|util.assignment}}
 
{{JavaToImplement|Length|length|util.assignment}}

Revision as of 04:52, 17 January 2020

Code To Implement

class DefaultImmutableList implements ImmutableList<E>

Length

class: Length.java Java.png
methods: length
package: util.assignment
source folder: src/main/java

public static <E> int length(ImmutableList<E> list)

SumProductCountdownFactorial

class: SumProductCountdownFactorial.java Java.png
methods: sum
product
countdown
factorial
package: util.assignment
source folder: src/main/java

sum

public static int sum(ImmutableList<Integer> xs)

product

public static int product(ImmutableList<Integer> xs)

countdown

public static ImmutableList<Integer> countdown(int n)

factorial

public static int factorial(int n)

Append

class: Append.java Java.png
methods: append
package: util.assignment
source folder: src/main/java

public static <E> ImmutableList<E> append(ImmutableList<E> xs, ImmutableList<E> ys)

Test

class: ImmutableListTestSuite.java Junit.png
package: util.assignment
source folder: src/test/java