Tell me please. There is an array of ArrayList. I declare it in the class of variables:
private ArrayList<Part> parts; How to write a check whether it is initialized or not? and if not, initialize. The following code is incorrect:
public ArrayList<Part> initArrayList(Part part){ if (parts.isEmpty()) { parts = new ArrayList<>(); parts.add(part); } else parts.add(part); return parts;