DEV Community

Discussion on: Removing repetitions from Array using the class Set

Collapse
 
pentacular profile image
pentacular • Edited

I think there are two points that are worth clarifying.

  1. You aren't removing anything from the array -- you're producing a new array without duplicates.
  2. Any information due to ordering of items in the array is lost.

So, this is really about producing an array to represent the set of items in another array, which is what you're actually doing. :)

EDIT: Actually, as Sets are iterated in insertion order, the relative orders are preserved, but not the indices.

Collapse
 
gabrielrufino profile image
Gabriel Rufino • Edited

Hahahaha how much preciousness. Let me guess, are u a functional programmer? Congratz

My intention here isn't to be precise with my words. It's totally possible to understand the "removing"

I'm sorry, Mr. English. But, thank you!!