-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathCropRow.java
More file actions
52 lines (36 loc) · 971 Bytes
/
CropRow.java
File metadata and controls
52 lines (36 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.zipcodewilmington.froilansfarm;
import com.zipcodewilmington.froilansfarm.plants.Crop;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class CropRow {
private final List<Crop> row = new LinkedList<>();
public CropRow() {}
public CropRow(Crop crop) {
this.row.add(crop);
}
public CropRow(Crop[] crops) {
this.row.addAll(Arrays.asList(crops));
}
public CropRow(List<Crop> crops) {
this.row.addAll(crops);
}
public List<Crop> getCrops() {
return this.row;
}
public void store(Crop crop) {
this.row.add(crop);
}
public void store(Crop[] crops) {
this.row.addAll(Arrays.asList(crops));
}
public void store(List<Crop> crops) {
this.row.addAll(crops);
}
public boolean fertilize() {
for (Crop crop : this.row) {
crop.fertilize();
}
return false;
}
}