Package cs2030s.fp
Class Lazy<T>
- java.lang.Object
-
- cs2030s.fp.Lazy<T>
-
- All Implemented Interfaces:
Immutatorable<T>
- Direct Known Subclasses:
Memo
public class Lazy<T> extends java.lang.Object implements Immutatorable<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Lazy<T>from(Constant<? extends T> v)static <T> Lazy<T>from(T v)Tget()<R> Lazy<R>next(Immutator<? extends Lazy<? extends R>,? super T> f)java.lang.StringtoString()<R> Lazy<R>transform(Immutator<? extends R,? super T> f)The method to produce another container with immutated element.
-
-
-
Method Detail
-
get
public T get()
-
from
public static <T> Lazy<T> from(T v)
-
transform
public <R> Lazy<R> transform(Immutator<? extends R,? super T> f)
Description copied from interface:ImmutatorableThe method to produce another container with immutated element.- Specified by:
transformin interfaceImmutatorable<T>- Type Parameters:
R- the return type- Parameters:
f- The immutator.- Returns:
- A new container containing the immutated element.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-