The 'isEmpty' feature request got me thinking of some other useful utilities that would be simple to implement and in my opinion improve usability and readability.
- `.clear()` remove all atoms/bonds from the AtomContainer/ContainerSets etc. - simply invokes the `removesAllAtomsAndBonds`
- `addAtom()` and `addBond` could return true/false as to whether the container was modified - this is useful as there is currently no indication when duplicates are added.
~~~~~:::java
public void addAtom(IAtom atom)
{
if (contains(atom))
{
return; // false
}
if (atomCount + 1 >= atoms.length)
{
growAtomArray();
}
atoms[atomCount] = atom;
atomCount++;
// return true
}
~~~~~
Oh and we can also do this...
currently code reads as follows:
container.addAtom(atom)- container add atom atomthis could easily be reduced to
container.add(atom)- container add atomThe existing methods could stay but the util methods would make implementing code look a lot cleaner.