def separate_duplicates!
max_crawls = @size*@size
keys = {}
@all.each{ |list_item|
keys[list_item] = block_given? ? yield(list_item) : list_item
}
crawls=0
dup_distance = 0
while dup_distance < @size && (crawls < max_crawls)
if keys[@current] == keys[@current.next]
dup_distance = 0
n = 1
begin; swapper = self[n+=1]; end until (keys[@current] != keys[swapper]) || (n==@size)
self.swap( @current.next, swapper )
else
dup_distance += 1
end
self.increment
crawls+=1
end
raise "Error: #separate_duplicates! was unsuccessful after #{crawls} rounds." if dup_distance < @size
self
end