Skip to content

Instantly share code, notes, and snippets.

View aashritag's full-sized avatar

Aashrita Goel aashritag

View GitHub Profile
Source(1 to 10)
.throttle(1, 1.second)
.runForeach(println)
val source: Source[Int, NotUsed] = Source(1 to 10)
source.filter(_ % 2 == 0).runForeach(println)
source.filter(_ % 2 != 0).runForeach(println)
val users = List(
User(1, "Aashrita", 22),
User(2, "Mark", 12),
User(3, "Ron", 19),
User(4, "Adam", 20)
)
val userSource: Source[User, NotUsed] = Source(users)
def writeToFile(filename: String): Sink[User, Future[IOResult]] = {