Method: Array#nonuniq!

Defined in:
lib/core/facets/array/nonuniq.rb

#nonuniq!Object

Same as #nonuniq but acting in place.



20
21
22
23
24
25
26
27
28
# File 'lib/core/facets/array/nonuniq.rb', line 20

def nonuniq!
  h1 = {}
  h2 = {}
  each {|i|
    h2[i] = true if h1[i]
    h1[i] = true
  }
  self.replace(h2.keys)
end