Kotlin Exercises
Kotlin Exercises
About the Book
This is a collection of exercises and solutions from Kotlin Essentials, Functional Kotlin, Kotlin Coroutines: Deep Dive, and Advanced Kotlin.
Table of Contents
- Introduction
- Kotlin Essentials exercises
- Exercise: Your first program
- Exercise: Basic values operations
- Exercise: Using when
- Exercise: Pretty time display
- Exercise: Person details display
- Exercise: Range Operations
- Exercise: User Information Processor
- Exercise: Implementing the Product class
- Exercise: GUI View Hierarchy Simulation
- Exercise: Data class practice
- Exercise: Pizza factory
- Exercise: Catching exceptions
- Exercise: Days of the week enum
- Exercise: Conversion and measurement unit creation
- Exercise: Inventory management
- Exercise: Money operations
- Exercise: The closest supertype of types
- Exercise: Stock
- Final Project: Workout manager
- Exercise: Function types and literals
- Exercise: Observable value
- Exercise: Inferred function types
- Exercise: Function references
- Exercise: Inline functions
- Exercise: Implement map
- Exercise: Optimize collection processing
- Exercise: Adding element at position
- Exercise: Implement shop functions
- Exercise: Prime access list
- Exercise: Top articles
- Exercise: Refactor collection processing
- Exercise: Passing students list
- Exercise: Best students list
- Exercise: Functional Quick Sort
- Exercise: Powerset
- Exercise: All possible partitions of a set
- Exercise: Understanding sequences
- Exercise: HTML table DSL
- Exercise: Creating user table row
- Exercise: Using scope functions
- Exercise: orThrow
- Exercise: Logger
- Final Project: UserService
- Exercise: Factorial sequence
- Exercise: Prime numbers sequence
- Exercise: Callback function wrappers
- Exercise: Continuation storage
- Exercise: What is stored by a continuation?
- Exercise: UserDetailsRepository
- Exercise: BestStudentUseCase
- Exercise: CommentService
- Exercise: mapAsync
- Exercise: Understanding context propagation
- Exercise: CounterContext
- Exercise: Using dispatchers
- Exercise: DiscNewsRepository
- Exercise: Experiments with dispatchers
- Exercise: Correct mistakes with cancellation
- Exercise: NotificationSender
- Exercise: BaseViewModel
- Exercise: UserDownloader
- Exercise: CompanyDetailsRepository
- Exercise: CancellingRefresher
- Exercise: TokenRepository
- Exercise: Suspended lazy
- Exercise: mapAsync with concurrency limit
- Exercise: Test UserDetailsRepository
- Exercise: Testing mapAsync
- Exercise: Testing the NotificationSender class
- Exercise: Testing a View Model
- Exercise: UserRefresher
- Exercise: Cafeteria simulation
- Exercise: raceOf
- Exercise: Flow utils
- Exercise: All users flow
- Exercise: distinct
- Exercise: TemperatureService
- Exercise: NewsViewModel
- Exercise: ProductService
- Exercise: Flow Kata
- Exercise: MessageService
- Exercise: Update ProductService
- Exercise: Update TemperatureService
- Exercise: LocationService
- Exercise: PriceService
- Exercise: NewsViewModel using stateIn
- Exercise: Flow testing
- Exercise: Usage of generic types
- Exercise: Generic Response
- Exercise: Generic Consumer
- Exercise: ApplicationScope
- Exercise: Lateinit delegate
- Exercise: Blog Post Properties
- Exercise: Mutable lazy delegate
- Exercise: Coroutine time measurement
- Exercise: Adjust Kotlin for Java usage
- Exercise: Multiplatform LocalDateTime
- Exercise: Migrating a Kotlin/JVM project to KMP
- Exercise: Function caller
- Exercise: Object serialization to JSON
- Exercise: Object serialization to XML
- Exercise: DSL-based dependency injection library
- Exercise: Mocking library
- Exercise: Annotation Processing execution measurement wrapper
- Exercise: KSP execution measurement wrapper
- Exercise: A mutability problem
- Exercise: Flow with history
- Exercise: Correct InMemoryUserRepository
- Exercise: Chunking a flow
- Exercise: Specify expectations
- Exercise: Unit testing
- Exercise: Unit testing using mocks
- Exercise: Composition vs inheritance
- Exercise: Make DeckConnector comparable
- Exercise: Correct EventListenerRegistry
- Exercise: Market data processing optimization
- Exercise: Prime access list
- Exercise: Crime analysis
- Exercise solutions
- Solution: Basic values operations
- Solution: Using when
- Solution: Pretty time display
- Solution: Person details display
- Solution: Range Operations
- Solution: User Information Processor
- Solution: Implementing the Product class
- Solution: GUI View Hierarchy Simulation
- Solution: Data class practice
- Solution: Pizza factory
- Solution: Catching exceptions
- Solution: Days of the week enum
- Solution: Conversion and measurement unit creation
- Solution: Inventory management
- Solution: Money operations
- Solution: The closest supertype of types
- Solution: Stock
- Solution: Workout manager
- Solution: Function types and literals
- Solution: Observable value
- Solution: Inferred function types
- Solution: Function references
- Solution: Inline functions
- Solution: Implement map
- Solution: Optimize collection processing
- Solution: Adding element at position
- Solution: Implement shop functions
- Solution: Prime access list
- Solution: Top articles
- Solution: Refactor collection processing
- Solution: Passing students list
- Solution: Best students list
- Solution: Functional Quick Sort
- Solution: Powerset
- Solution: All possible partitions of a set
- Solution: Understanding sequences
- Solution: HTML table DSL
- Solution: Creating user table row
- Solution: Using scope functions
- Solution: orThrow
- Solution: Logger
- Solution: UserService
- Solution: Factorial sequence
- Solution: Prime numbers sequence
- Solution: Callback function wrappers
- Solution: Continuation storage
- Solution: What is stored by a continuation?
- Solution: UserDetailsRepository
- Solution: BestStudentUseCase
- Solution: CommentService
- Solution: mapAsync
- Solution: Understanding context propagation
- Solution: CounterContext
- Solution: Using dispatchers
- Solution: DiscNewsRepository
- Solution: Experiments with dispatchers
- Solution: Correct mistakes with cancellation
- Solution: NotificationSender
- Solution: BaseViewModel
- Solution: UserDownloader
- Solution: CompanyDetailsRepository
- Solution: CancellingRefresher
- Solution: TokenRepository
- Solution: Suspended lazy
- Solution: mapAsync with concurrency limit
- Solution: Test UserDetailsRepository
- Solution: Testing mapAsync
- Solution: Testing the NotificationSender class
- Solution: UserRefresher
- Solution: Cafeteria simulation
- Solution: raceOf
- Solution: Flow utils
- Solution: All users flow
- Solution: distinct
- Solution: TemperatureService
- Solution: NewsViewModel
- Solution: ProductService
- Solution: Flow Kata
- Solution: MessageService
- Solution: Update ProductService
- Solution: Update TemperatureService
- Solution: LocationService
- Solution: PriceService
- Solution: NewsViewModel using stateIn
- Solution: Usage of generic types
- Solution: Generic Response
- Solution: Generic Consumer
- Solution: ApplicationScope
- Solution: Lateinit delegate
- Solution: Blog Post Properties
- Solution: Mutable lazy delegate
- Solution: Coroutine time measurement
- Solution: Adjust Kotlin for Java usage
- Solution: Multiplatform LocalDateTime
- Solution: Migrating a Kotlin/JVM project to KMP
- Solution: Function caller
- Solution: Object serialization to JSON
- Solution: Object serialization to XML
- Solution: DSL-based dependency injection library
- Solution: Mocking library
- Solution: Annotation Processing execution measurement wrapper
- Solution: KSP execution measurement wrapper
- Solution: A mutability problem
- Solution: Flow with history
- Solution: Correct InMemoryUserRepository
- Solution: Chunking a flow
- Solution: Specify expectations
- Solution: Make DeckConnector comparable
- Solution: Correct EventListenerRegistry
- Solution: Market data processing optimization
- Solution: Crime analysis
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them