-
Notifications
You must be signed in to change notification settings - Fork 19
2.17 Lookup a column
mark lister edited this page Feb 26, 2015
·
2 revisions
You can also lookup a column by constructing a Map
import com.github.marklister.collections._
val data= CollSeq(("Zesa",10,20),
("Eskom",5,11),
("Sars",16,13))
val lookupByColumn= (Seq("Company","Rating","FwdPE") zip data.productIterator.toSeq).toMap
lookupByColumn("Company")
res6: Seq[Any] = List(Zesa, Eskom, Sars)
lookupColumn("FwdPE")
res7: Seq[Any] = List(20, 11, 13)
Unfortunately the underlying type is a Seq[Any]
, which is the most specific type productIterator
can return.