Package at.jku.ssw.fp.sect03_1
Class Demo3_Memoize
- java.lang.Object
-
- at.jku.ssw.fp.sect03_1.Demo3_Memoize
-
public class Demo3_Memoize extends Object
Demos of memoization.- Author:
- Herbert Praehofer
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static Map<Long,Boolean>
primeCache
-
Constructor Summary
Constructors Constructor Description Demo3_Memoize()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static boolean
isPrime(long n)
static boolean
isPrimeWithCache(long n)
static void
main(String[] args)
(package private) static <T,R>
Function<T,R>memoize(Function<T,R> fn)
static <T,R>
Function<T,R>memoize2(Function<T,R> fn)
-
-
-
Method Detail
-
main
public static void main(String[] args)
-
isPrime
static boolean isPrime(long n)
-
isPrimeWithCache
public static boolean isPrimeWithCache(long n)
-
-