code: public List<CmsCategory> getLeafItems() {
  
          List<CmsCategory> result = new ArrayList<CmsCategory>();
          if (m_categories.isEmpty()) {
              return result;
          }
          Iterator<CmsCategory> it = m_categories.iterator();
          CmsCategory current = it.next();
          while (it.hasNext()) {
              CmsCategory next = it.next();
              if (!next.getPath().startsWith(current.getPath())) {
                  result.add(current);
              }
              current = next;
          }
          result.add(current);
          return result;
      }
docs: Returns only the leaf categories of the wrapped categories.
  
  The method assumes that categories are ordered in the list, i.e., parents are directly followed by their children.
  
  NOTE: In the complete category tree a leaf of the wrapped tree part may not be a leaf.
  
  @return only the leaf categories of the wrapped categories.