code: private static void trimPadding(List<Element> elements)
      {
          for (ListIterator<Element> it = elements.listIterator(elements.size()); it.hasPrevious();) {
              Element element = it.previous();
  
              if (element.compareTo(null) == 0) {
                  it.remove();
              } else {
                  break;
              }
          }
      }
docs: Remove empty elements.
  
  @param elements the list of clean