@@ -97,7 +97,7 @@ mutator and accessor methods (respectively). Instead, the following
97
97
conventions are used:
98
98
99
99
- For accessors of properties, the name of the method should be the
100
- name of the property
100
+ name of the property.
101
101
- In some instances, it is acceptable to prepend "\` is\` " on a boolean
102
102
accessor (e.g. ` isEmpty ` ). This should only be the case when no
103
103
corresponding mutator is provided. Please note that the
@@ -111,21 +111,21 @@ conventions are used:
111
111
mirrors assignment. Note that this is not just a convention but a
112
112
requirement of the language.
113
113
114
- class Foo {
115
-
116
- def bar = ...
117
-
118
- def bar_ =(bar: Bar) {
119
- ...
120
- }
121
-
122
- def isBaz = ...
123
- }
114
+ class Foo {
115
+
116
+ def bar = ...
117
+
118
+ def bar_=(bar: Bar) {
119
+ ...
120
+ }
121
+
122
+ def isBaz = ...
123
+ }
124
124
125
- val foo = new Foo
126
- foo.bar // accessor
127
- foo.bar = bar2 // mutator
128
- foo.isBaz // boolean property
125
+ val foo = new Foo
126
+ foo.bar // accessor
127
+ foo.bar = bar2 // mutator
128
+ foo.isBaz // boolean property
129
129
130
130
131
131
Quite unfortunately, these conventions fall afoul of the Java convention
@@ -173,8 +173,7 @@ use an immutable reference to a property class that contains its own
173
173
getter and setter. For example:
174
174
175
175
class Company {
176
- val string : Property[String] =
177
- Property("Initial Value")
176
+ val string: Property[String] = Property("Initial Value")
178
177
179
178
### Parentheses
180
179
@@ -273,23 +272,23 @@ should be used, following the class naming conventions (as opposed to an
273
272
all-uppercase style):
274
273
275
274
// Right
276
- class Map[Key,Value] {
277
- def get(key:Key): Value
278
- def put(key:Key,value:Value): Unit
275
+ class Map[Key, Value] {
276
+ def get(key: Key): Value
277
+ def put(key: Key, value: Value): Unit
279
278
}
280
279
281
280
// Wrong; don't use all-caps
282
- class Map[KEY,VALUE] {
283
- def get(key:KEY): VALUE
284
- def put(key:KEY,value:VALUE): Unit
281
+ class Map[KEY, VALUE] {
282
+ def get(key: KEY): VALUE
283
+ def put(key: KEY, value: VALUE): Unit
285
284
}
286
285
287
286
If the scope of the type parameter is small enough, a mnemonic can be
288
287
used in place of a longer, descriptive name:
289
288
290
- class Map[K,V] {
291
- def get(key:K): V
292
- def put(key:K, value:V): Unit
289
+ class Map[K, V] {
290
+ def get(key: K): V
291
+ def put(key: K, value: V): Unit
293
292
}
294
293
295
294
### Higher-Kinds and Parameterized Type parameters
0 commit comments