Here is a code in Ruby. I’m just trying to simplify it. Do you have any ideas?
def foo
points = some_collection.map { |item| {:key1 => item.key1, :key2 => item.key2, :key3 => item.key3, :key4=> item.key4} }
some_collection2.each do |item2|
points << {:key1 => item2.key1, :key2 => item2.key2, :key3 => item2.key3, :key4=> item2.key4}
end
points
end
If I understand correctly the mapping function is the same for both collections in your case.