Patch from Fredrik Westermarck <fredrik.westermarck@mdh.se> that adds the containsOnly method. I added a couple more unit tests and modified the code slightly.