input: Write a function to optimize the given Python code that removes duplicates from an array using built-in functions. The function should return a new array with all unique elements in the order they first appeared.
  assert removeDuplicates([1, 2, 2, 3, 4, 4, 5])==[1, 2, 3, 4, 5]
  assert removeDuplicates([5, 5, 5, 5, 5])==[5]
  assert removeDuplicates([3, 7, 2, 2, 7, 3, 1])==[3, 7, 2, 1]
  assert removeDuplicates([])==[]
  assert removeDuplicates([2, 2, 2, 2])==[2]
output: def removeDuplicates(arr):
      seen = set()
      result = []
      for item in arr:
          if item not in seen:
              seen.add(item)
              result.append(item)
      return result