Skip to content

Commit

Permalink
[4.x]: Fix wrong example for Config.onChange (#8607) (#8608)
Browse files Browse the repository at this point in the history
  • Loading branch information
Captain1653 authored Apr 4, 2024
1 parent 30d29e9 commit 33c7b97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/se/config/mutability-support.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ method on the node of interest.
include::{sourcedir}/se/config/MutabilitySupportSnippets.java[tag=snippet_3, indent=0]
----
<1> Navigate to the `Config` node on which you want to register.
<2> Invoke the `onChange` method, passing a function (`Function<Config, Boolean>`).
The config system invokes that function each time the subtree rooted at the
<2> Invoke the `onChange` method, passing a consumer (`Consumer<Config>`).
The config system invokes that consumer each time the subtree rooted at the
`greeting` node changes. The `changedNode` is a new instance of `Config`
representing the updated subtree rooted at `greeting`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void snippet_2() {
void snippet_3(Config config) {
// tag::snippet_3[]
config.get("greeting") // <1>
.onChange((changedNode) -> { // <2>
.onChange(changedNode -> { // <2>
System.out.println("Node " + changedNode.key() + " has changed!");
});
// end::snippet_3[]
Expand Down

0 comments on commit 33c7b97

Please sign in to comment.