Skip to content

Commit 5013f7b

Browse files
author
Tomasz Lelek
committed
BAEL-614 without a fibonacci
1 parent 49bcf8c commit 5013f7b

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

‎core-java/src/main/java/com/baeldung/concurrency/BlockingQueueUsage.java‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,14 @@ public void run() {
6464
try {
6565
while (true) {
6666
Integer number = queue.take();
67-
int result = fibonacci(number);
68-
System.out.println("fibonacci result: " + result);
67+
String result = number.toString();
68+
System.out.println(Thread.currentThread().getName() + " result: " + result);
6969

7070
}
7171
} catch (InterruptedException e) {
7272
Thread.currentThread().interrupt();
7373
}
7474
}
7575

76-
public int fibonacci(Integer number) {
77-
if (number <= 1) return number;
78-
else return fibonacci(number - 1) + fibonacci(number - 2);
79-
}
8076
}
8177
}

0 commit comments

Comments
 (0)