📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
@ -23,8 +23,7 @@
|
||||
|
||||
package com.iluwatar.trampoline;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Trampoline pattern allows to define recursive algorithms by iterative loop.
|
||||
@ -33,17 +32,16 @@ import org.slf4j.LoggerFactory;
|
||||
* and to interleave the execution of functions without hard coding them together or even using
|
||||
* threads.
|
||||
*/
|
||||
@Slf4j
|
||||
public class TrampolineApp {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(TrampolineApp.class);
|
||||
|
||||
/**
|
||||
* Main program for showing pattern. It does loop with factorial function.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
log.info("start pattern");
|
||||
LOGGER.info("start pattern");
|
||||
var result = loop(10, 1).result();
|
||||
log.info("result {}", result);
|
||||
LOGGER.info("result {}", result);
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,10 @@ import org.junit.jupiter.api.Test;
|
||||
/**
|
||||
* Test for trampoline pattern.
|
||||
*/
|
||||
public class TrampolineAppTest {
|
||||
|
||||
class TrampolineAppTest {
|
||||
|
||||
@Test
|
||||
public void testTrampolineWithFactorialFunction() {
|
||||
void testTrampolineWithFactorialFunction() {
|
||||
long result = TrampolineApp.loop(10, 1).result();
|
||||
assertEquals(3_628_800, result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user