nus/Lab6/cs2030s/fp/Immutatorable.java
2022-11-08 18:03:40 +08:00

20 lines
601 B
Java

package cs2030s.fp;
/**
* Represent a container that can transforms its content to produce another
* container containing the immutated element, possible of different types.
* CS2030S Lab 5
* AY22/23 Semester 1
*
* @param <T> The type of the content.
*/
public interface Immutatorable<T> {
/**
* The method to produce another container with immutated element.
*
* @param <R> the return type
* @param f The immutator.
* @return A new container containing the immutated element.
*/
<R> Immutatorable<R> transform(Immutator<? extends R, ? super T> f);
}