Created
January 7, 2014 22:29
-
-
Save dbehnke/8308143 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.joda.time._ | |
val typedef = Seq("string", "datetime") | |
val data = Seq("hi","014-01-07T15:57:52.253-05:00") | |
val x: Seq[Any] = (for(i <- 0 to data.length - 1) | |
yield({ | |
if (i <= typedef.length) | |
typedef(i) match { | |
case "datetime" => new DateTime(data(i)) | |
case _ => data(i).asInstanceOf[String] | |
} | |
else data(i) | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given Two sequences:
Combines based on definition (typedef) the data into a sequence of Any type.
In the example result x: Seq[Any] = Vector(hi, 0014-01-07T15:25:41.253-05:32:11)