intersect() refactor

Added a check for right.isEmpty() to prevent a new TreeSet from being created and left elements from being added if right is empty and left is non-empty.