input: Write a function to optimize the given Python code to use built-in functions. The original code removes duplicates from an array using nested loops. If optimized code is able to remove duplicates using built-in functions, it should return the resulting array. If the input array is empty, it should return an empty array.
  assert removeDuplicates([1, 2, 2, 3, 4, 4])==[1, 2, 3, 4]
  assert removeDuplicates([5, 5, 5, 5, 5])==[5]
  assert removeDuplicates([1, 2, 3, 4])==[1, 2, 3, 4]
  assert removeDuplicates([])==[]
  assert removeDuplicates([1, 1, 2, 2, 3, 3, 4, 4])==[1, 2, 3, 4]
output: def removeDuplicates(arr):
      return list(dict.fromkeys(arr))