input: Write a function to optimize the given Python code that removes duplicates from an array using built-in functions. The original function uses nested loops and the `pop` method, which is inefficient. The optimized function should use a list comprehension or a set to remove duplicates.
  
  ### Original Code:
  
  def removeDuplicates(array): 
      for i in range (len(array)): 
          for j in range (i + 1, len(array)): 
              if array[i] == array[j]: 
                  array.pop(j)
  
  
  ### Optimized Code:
  
  def removeDuplicates(array): 
      finalArray = []
      for element in array: 
          if element not in finalArray: 
              finalArray.append(element)
      return finalArray
  
  
  ### Assertions:
  
  assert removeDuplicates([1, 2, 2, 3, 4, 4, 5]) == [1, 2, 3, 4, 5]
  assert removeDuplicates([5, 5, 5, 5]) == [5]
  assert removeDuplicates([]) == []
  assert removeDuplicates([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]
  assert removeDuplicates([1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == [1, 2, 3, 4, 5]
  
output: def removeDuplicates(array): 
      return list(set(array))