If fields a and b , I just write
(sequence map (_.a), sequence map (_.b))
OK, you go through the sequence twice, but traversing the list is so cheap, I would say it is faster than using Option.get.
edit: after Rexβs comment, I couldnβt resist running the test; results below ...
times in ms for 100 traversals of 10000 elem collection, L = List, A = Array, V = Vector
Your results may vary depending on the processor, memory, JRE version, collection size, moon phase, etc.
source share