Skip to content

TofigBakhshiyev/Scala-Concurrent-learn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Scala Concurrent Learn

Learn about scala futures and promises, concurrent programming

Scala Future Basics

Learn about Futures and how to print its results, Feature is used for read. example code

Scala Promise

Promise can be written (normally only once), Promise is used for write. example code

Scala Concurrent example

How to do calculation concurrently with Features. example code

Scala Synchronous example

How to do calculation synchronously with Features, used Await.result to wait result. example code

Scala Parallel calculation example

How to do calculation parallel with Features, used Future.sequence. example code

Scala Parallel-2 calculation example

How to do calculation parallel with Features, used Future.traverse, traverse and sequence are similar, difference is that traverse easily convert all the Option[Int] into just Int type. example code

Scala Zip two features example

The Future.zip will create a new future, whose return type will be a tuple holding the return types of the two futures. example code-1, example dode-2

Scala FoldLeft example

The foldLeft on your future operations will be run asynchronously from left to right. example code

Scala ReduceLeft example

The reduceLeft is similar with foldLeft, however, reduceLeft() does not allow you to provide a default value. example code

Scala FutureThen example

The andThen is used for passing partialFunction. example code

Scala FirstCompletedOf callback function example

The firstCompletedOf return any one of the futures which finish first. example code

Scala ExecutionContext example

In this example, learn how to create single threaded executionContext. example code

Scala Future recover example

The recover function recovers error message. example code

More resources for concurrent and parallel programming in Scala