class FragmentUtils {

    protected static List<IBond> traverse(IAtomContainer atomContainer, IAtom atom, List<IBond> bondList) {
        List<IBond> connectedBonds = atomContainer.getConnectedBondsList(atom);
        for (IBond aBond : connectedBonds) {
            if (bondList.contains(aBond)) continue;
            bondList.add(aBond);
            IAtom nextAtom = aBond.getOther(atom);
            if (atomContainer.getConnectedBondsCount(nextAtom) == 1) continue;
            traverse(atomContainer, nextAtom, bondList);
        }
        return bondList;
    }

}