Skip to content

Commit 33ff997

Browse files
committed
docs: revised according to review.
1 parent 2dfa19c commit 33ff997

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

examples/07_Delegation/01_delegationPattern.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ fun main() {
3434
</div>
3535

3636

37-
1. The interface `SoundBehavior` with one method is defined.
38-
2. The classes `ScreamBehavior` and `RockAndRollBehavior` implement the interface and contain own implementations on the method.
37+
1. Defines the interface `SoundBehavior` with one method.
38+
2. The classes `ScreamBehavior` and `RockAndRollBehavior` implement the interface and contain their own implementations of the method.
3939
3. The classes `TomAraya` and `ElvisPresley` also implement the interface, but not the method. Instead, they delegate the method calls to the
4040
responsible implementation. The delegate object is defined after the `by` keyword. As you see, no boilerplate code is required.
4141
4. When `makeSound()` is called on `tomAraya` of type `TomAraya` or `elvisPresley` of type `ElvisPresley`, the call is delegated to the

examples/07_Delegation/02_DelegatedProperties.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Delegated Properties
22

3-
Kotlin provides a mechanism of [delegated properties](http://kotlinlang.org/docs/reference/delegated-properties.html) that allow delegating the calls of the property `set` and `get` methods to a certain object.
3+
Kotlin provides a mechanism of [delegated properties](http://kotlinlang.org/docs/reference/delegated-properties.html) that allows delegating the calls of the property `set` and `get` methods to a certain object.
44
The delegate object in this case should have the method `getValue`. For mutable properties, you'll also need `setValue`.
55

66
<div class="language-kotlin" theme="idea" data-min-compiler-version="1.3">
@@ -33,14 +33,13 @@ fun main() {
3333

3434
</div>
3535

36-
1. Delegating property `p` of type `String` to the instance of class `Delegate`. The delegate object is defined after the `by` keyword.
36+
1. Delegates property `p` of type `String` to the instance of class `Delegate`. The delegate object is defined after the `by` keyword.
3737
2. Delegation methods. The signatures of these methods are always as shown in the example. Implementations may contain any steps you need. For immutable properties only `getValue` is required.
3838

3939
### Standard Delegates
4040

41-
Kotlin standard library contains bunch of useful delegates, like `lazy`, `observable`, etc. You may use them as is.
42-
43-
For example `lazy` is used in case lazy initialization.
41+
The Kotlin standard library contains a bunch of useful delegates, like `lazy`, `observable`, and other. You may use them as is.
42+
For example `lazy`is used for lazy initialization.
4443

4544
<div class="language-kotlin" theme="idea" data-min-compiler-version="1.3">
4645

0 commit comments

Comments
 (0)