code: static String[] listToArray(List<String> elements, String defaultValue){
          if (elements == null || elements.isEmpty()) return new String[]{defaultValue};
  
          String[] elementsArr = new String[elements.size()];
          elements.toArray(elementsArr);
  
          return elementsArr;
      }
docs: Converts a {@link List} of {@link String} into a {@link String} array.
  @param elements The {@link List} of {@link String} objects.
  @param defaultValue A default value, used if the {@link List} is either empty or null.
  @return The {@link String} array.