help
package pl.codegym.task.task17.task1705;
import java.util.ArrayList;
import java.util.List;
/*
Wizyta w ogrodzie
*/
public class Solution {
public static void main(String[] args) {
}
public static class Garden {
public final List<String> fruits = new ArrayList<>();
public final List<String> vegetables = new ArrayList<>();
public void addFruit(int index, String fruit) {
synchronized (this) {
fruits.add(fruit);
}
}
public void removeFruit(int index) {
synchronized (this) {
fruits.remove(index);
}
}
public void addVegetables(int index, String vegetable) {
synchronized (this) {
vegetables.add(vegetable);
}
}
public void removeVegetables(int index) {
synchronized (this) {
vegetables.remove(index);
}
}
}
}