|
@@ -2,6 +2,7 @@ package rocks.zipcode.quiz5.collections;
|
2
|
2
|
|
3
|
3
|
import rocks.zipcode.quiz5.objectorientation.Spice;
|
4
|
4
|
|
|
5
|
+import java.util.ArrayList;
|
5
|
6
|
import java.util.List;
|
6
|
7
|
import java.util.Map;
|
7
|
8
|
|
|
@@ -9,8 +10,15 @@ import java.util.Map;
|
9
|
10
|
* @author leon on 27/12/2018.
|
10
|
11
|
*/
|
11
|
12
|
public class Food {
|
|
13
|
+ private ArrayList<Spice> spices = new ArrayList<>();
|
|
14
|
+ private Spice spice;
|
|
15
|
+
|
12
|
16
|
public List<Spice> getAllSpices() {
|
13
|
|
- return null;
|
|
17
|
+ for (Spice sp : spices){
|
|
18
|
+ spices.add(sp);
|
|
19
|
+ }
|
|
20
|
+
|
|
21
|
+ return spices;
|
14
|
22
|
}
|
15
|
23
|
|
16
|
24
|
public <SpiceType extends Class<? extends Spice>> Map<SpiceType, Integer> getSpiceCount() {
|
|
@@ -18,5 +26,6 @@ public class Food {
|
18
|
26
|
}
|
19
|
27
|
|
20
|
28
|
public void applySpice(Spice spice) {
|
|
29
|
+ this.spice = spice;
|
21
|
30
|
}
|
22
|
31
|
}
|