code: private void addToList(List<Object> list, Object value) {
      if (value instanceof List) {
        list.addAll((List) value);
      } else {
        list.add(value);
      }
    }
docs: Adds an object or objects to a List.