mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 16:14:58 +00:00
changes fixing mistakes
This commit is contained in:
1 parent
94fdefee3a
commit
f7825f6c99
6 files changed
+34
-44
No files matched your search
+12
-7
@@ -12,13 +12,16 @@ tags:
|
||||
---
|
||||
|
||||
## Intent
|
||||
By representing a computation in one of 2 states
|
||||
Trampoline pattern is used for implementing algorithms recursively in Java without blowing the stack
|
||||
and to interleave the execution of functions without hard coding them together
|
||||
It is possible by representing a computation in one of 2 states : done | more
|
||||
(completed with result, or a reference to the reminder of the computation,
|
||||
something like the way a java.util.Supplier does)
|
||||
it is possible to implement algorithms recursively in Java without blowing the stack
|
||||
and to interleave the execution of functions without hard coding them together or even using threads.
|
||||
something like the way a java.util.Supplier does).
|
||||
|
||||
|
||||
## Explanation
|
||||
Trampoline pattern allows to define recursive algorithms by iterative loop.
|
||||
|
||||
|
||||
## Applicability
|
||||
Use the Trampoline pattern when
|
||||
@@ -32,9 +35,11 @@ The time overhead of a reflection call is traded for the space overhead of an in
|
||||
Trampolines in Java usually involve the creation of a GenericListener to pass events to an outer class.
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
## Tutorials
|
||||
* [Trampolining: a practical guide for awesome Java Developers](https://medium.com/@johnmcclean/trampolining-a-practical-guide-for-awesome-java-developers-4b657d9c3076)
|
||||
* [Trampoline in java ](http://mindprod.com/jgloss/trampoline.html)
|
||||
* [cyclops-react](https://github.com/aol/cyclops-react)
|
||||
|
||||
## Credits
|
||||
* [library 'cyclops-react' uses the pattern](https://github.com/aol/cyclops-react)
|
||||
|
||||
|
||||
Reference in new issue
Block a user