Implementatio of mathematical set operations on generic java collections