This commit is contained in:
tigraboris
2018-01-08 14:45:38 +03:00
parent b61b64073a
commit 94fdefee3a
5 changed files with 171 additions and 5 deletions

View File

@ -24,15 +24,17 @@ and to interleave the execution of functions without hard coding them together o
Use the Trampoline pattern when
* For implementing tail recursive function. This pattern allows to switch on a stackless operation.
* For to interleaving the execution of two or more functions on the same thread.
* For interleaving the execution of two or more functions on the same thread.
## Known uses(real world examples)
* Trampoline refers to using reflection to avoid using inner classes, for example in event listeners.
The time overhead of a reflection call is traded for the space overhead of an inner class.
Trampolines in Java usually involve the creation of a GenericListener to pass events to an outer class.
## Credits
* [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)