code: public static List<IElement> elements(IMolecularFormula formula) {
  
          List<IElement> elementList = new ArrayList<IElement>();
          List<String> stringList = new ArrayList<String>();
          for (IIsotope isotope : formula.isotopes()) {
              if (!stringList.contains(isotope.getSymbol())) {
                  elementList.add(isotope);
                  stringList.add(isotope.getSymbol());
              }
  
          }
          return elementList;
      }
docs: Get a list of all Elements which are contained
  molecular.
  
  @param   formula The MolecularFormula to check
  @return          The list with the IElements in this molecular formula