Skip to content

Commit ce11d41

Browse files
committed
tp6 step 3 solution
1 parent ad86c5f commit ce11d41

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
package fmt.kotlin.fundamentals
22

33
class InventoryService {
4+
45
val bottles = mutableListOf<Bottle>()
56

67
val errors = mutableListOf<String>()
8+
9+
fun addAll(bottlesText: List<String>) {
10+
for (s in bottlesText) {
11+
s.toBottle()?.add() ?: errors.add(s)
12+
}
13+
}
14+
15+
fun Bottle.add() {
16+
bottles.add(this)
17+
}
718
}

0 commit comments

Comments
 (0)