Skip to content

Commit b2619e4

Browse files
committed
Merge branch 'master' of https://github.com/vehpsr/java-design-patterns into vehpsr-master
Conflicts: README.md
2 parents 911a350 + 15adc67 commit b2619e4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ Behavioral patterns are concerned with algorithms and the assignment of responsi
422422
**Applicability:** Use the Callback pattern when
423423
* When some arbitrary synchronous or asynchronous action must be performed after execution of some defined activity.
424424

425+
**Real world examples:**
426+
* [CyclicBarrier] (http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CyclicBarrier.html#CyclicBarrier%28int,%20java.lang.Runnable%29) constructor can accept callback that will be triggered every time when barrier is tripped.
427+
425428
## <a name="execute-around">Execute Around</a> [&#8593;](#list-of-design-patterns)
426429
**Intent:** Execute Around idiom frees the user from certain actions that should always be executed before and after the business method. A good example of this is resource allocation and deallocation leaving the user to specify only what to do with the resource.
427430

@@ -430,7 +433,6 @@ Behavioral patterns are concerned with algorithms and the assignment of responsi
430433
**Applicability:** Use the Execute Around idiom when
431434
* You use an API that requires methods to be called in pairs such as open/close or allocate/deallocate.
432435

433-
434436
# Frequently asked questions
435437

436438
**<a id="Q1">Q: What is the difference between State and Strategy patterns?</a>**

callback/src/main/java/com/iluwatar/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.iluwatar;
22

33
/**
4-
* Callback pattern is more native for dynamic languages where function are first-class citizen.
4+
* Callback pattern is more native for functional languages where function is treated as first-class citizen.
55
* Prior to Java8 can be simulated using simple (alike command) interfaces.
66
*/
77
public class App {

0 commit comments

Comments
 (0)