Use if-clause instead of try-catch in BagIterator#next() since the situation is in our control and has better performance as well. Added curly braces to if-clause in BagIterator#remove().