scala - Seq, SeqLike, GenSeq or GenSeqLike? -


when create function, should have take argument seq, seqlike, genseq, or genseqlike? (so many choices!)

my requirements can map on , produce collection same number , order of arguments before.

typically "program interfaces" , choose general type possible. in case, genseqlike.

is correct/idiomatic?

seqlike implementation layer seq allows specify return types. there extremely few things seqlike not seq, , arguably error. can feel comfortable not worrying -likes. (if want build new collections of type given , keep types straight, use canbuildfrom instead.)

so question whether use genseq or seq. problem genseq processing might done in parallel, means have avoid using operation violate expectations (e.g. summing foreach). furthermore, general consensus seems genx part of collections hierarchy overcomplicates collections , makes more difficult incorporate alternative choices of parallel collections. recommendation seq unless pretty sure have use-cases you'd parallel processing. if don't care, seq simpler reason , users of function.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -