← Înapoi la Urmăritori

Cel mai recent articol

Ultima verificare

Urmăritori 0 urmăritori
Articole: 61
  1. Coroutine Essentials

    When you’re on hold during a phone call, you might also check your email.

  2. How to Prevent Race Conditions in Coroutines

    Thanks to structured concurrency, there are a lot of concerns that we don’t have to handle manually when working with Kotlin coroutines.

  3. Generic Variance

    We’ve seen how we can implement interfaces and extend classes to create subtypes.

  4. Generics

    All the way back in Chapter 8, when we introduced collections, we saw our first generic type: List<String> … then we saw more generics in Chapter 9 when we looked at the Pair and Map classes.

  5. Handling Runtime Exceptions

    In real life, when we decide to do something, we primarily think in terms of a successful experience.

  6. Sealed Types

    In Chapter 5, we saw how limiting our options can be a good thing.

  7. Data Classes and Destructuring

    At the end of the last chapter, we saw how all objects in Kotlin inherit three functions from an open class called Any.

  8. Abstract and Open Classes

    In Chapter 12, we saw how we could use interfaces to create subtypes, and in the last chapter, we saw how we could use delegation with interfaces in order to share general code among specific classes.

  9. Introduction to Class Delegation

    Back in Chapter 2, we introduced functions as a way to prevent us from duplicating expressions.

  10. Introduction to Interfaces

    Ever since Chapter 1, we’ve used a variety of built-in Kotlin types, like Int, String, and Boolean.

  11. Scopes and Scope Functions

    In the last chapter, we learned how to create extension functions, which can be called using dot notation.

  12. Receivers and Extensions

    Kotlin extensions can be used to add new functions and properties to existing classes—even to classes that you didn’t write!

  13. Collections: Maps

    In the last chapter, we saw how collections, such as lists and sets, can be used to do things that couldn’t be done easily with separate, individual variables.

  14. Collections: Lists and Sets

    So far, we’ve only worked with variables as individual values.

  15. Lambdas and Function References

    As we’ve seen, functions are a basic building block of Kotlin code.

  16. Nulls and Null Safety

    So far in this book, every time that we created a variable, whether it was a String, an Int, or a Boolean, we assigned a value to it.

  17. Enum Classes in Kotlin

    In the last chapter, we created our very own type, called Circle, using a feature in Kotlin called a class.

  18. Examples of Classes in Kotlin

    One core concept in Kotlin is a class, which allows you to combine variables and functions into a single unit.

  19. Introduction to Classes and Objects

    In Chapter 1, we learned about a variety of types in Kotlin, such as Double, String, and Boolean.

  20. Kotlin Conditionals: When and If

    In real life, we do different things depending on the circumstances.

  21. Functions

    In the last chapter, we wrote some Kotlin code to calculate the circumference of individual circles.

  22. Variables, Expressions, and Types

    So you want to be a Kotlin developer?

  23. When to Use Sequences

    One of the most common questions I get about Kotlin’s sequences is this: “When should I use sequences, and when should I use normal collections?”

  24. Inside Sequences: Create Your Own Sequence Operations

    Sequences are a fantastic way to process collections of data in a way that can perform better than the standard collection operations, as we saw in the previous article, Kotlin Sequences: An Illustrated Guide.

  25. Kotlin Sequences: An Illustrated Guide

    You’ve probably come across Kotlin’s sequences at one time or another.

  26. Inline Classes and Autoboxing

    In the last article, we discovered how Kotlin’s inline classes feature allows us to “create the data types that we want without giving up the performance that we need.”

  27. An Introduction to Inline Classes

    Whether you’re writing massive data-chomping processes that run in the cloud, or mobile apps that run on low-powered cell phones, most of us want our code to run fast.

  28. How to Enable Kotlin 1.3 Inline Classes Today

    Heads Up This article was written waaaay back in 2018 when the current version of Kotlin was 1.2.60.

  29. If you’ve ever had trouble remembering the difference between parameters and arguments, today’s article is for you!

  30. All About Type Aliases in Kotlin

    Have you ever had a conversation like this?

  31. Star-Projections and How They Work

    Have you ever wondered how star-projections work?

  32. The Ins and Outs of Generic Variance in Kotlin

    Have you ever wondered why generic variance works like it does?

  33. Generics can often seem confusing.

  34. Out-Projection

    An out-projection is a kind of type projection that makes a generic covariant, but also causes any functions that accept the type parameter to be unusable in that context.

  35. In-Projection

    An in-projection is a kind of type projection that makes a generic contravariant, but also causes any functions that return the type parameter to return it as a more abstract type.

  36. Declaration-Site Variance

    Declaration-Site Variance is variance that is specified at the point where the generic is defined – for example, in the definition of the class, interface, function, or extension property.

  37. Type Argument

    A type argument is a specific type, specified by the calling code, that a generic will use in place of a type parameter.

  38. Type Parameter

    A type parameter is a placeholder for an actual type, which gets specified by the code that’s using the generic.

  39. Type Projection

    A type projection is a type that has been limited in certain ways in order to gain variance characteristics.

  40. Variance Annotation

    A variance annotation is a modifier applied to a type parameter or type argument of a generic, in order to declare its variance.

  41. Invariance

    When dealing with simple classes, subtyping is straightforward.

  42. Contravariance

    Most of the time, subtyping is intuitive.

  43. Covariance

    On the surface, subtypes seem straightforward.

  44. Getting Real with Kotlin's Reified Type Parameters

    Let’s think for a moment about everything that you can do with a class name in Kotlin - think of all the cases where you literally type out the name of a class in your source code.

  45. Reified Type Parameter

    Reified type parameters are type parameters that retain more characteristics of actual types than normal type parameters do.

  46. Kotlin allows you to constrain a type parameter on a generic when you declare it, limiting the range of types that it can accept.

  47. Type Parameter Constraint

    Overview Type parameter constraints allow you to limit the types that can be accepted as a type argument to an upper bound, giving you the ability to invoke functions and properties on an object while preserving the type.

  48. Type Parameter Declaration

    Overview Generics allow you to create interfaces, classes, functions, and extension properties that can work with a “fill-in-the-blank” type, where the calling code can choose the type that should be used.

  49. Generic Function

    Overview Generic functions are functions that accept a type parameter, which allows different call sites to pass different types, without sacrificing type safety.

  50. Choosing between with() and run()

    In Kotlin’s standard library, the Standard.kt file contains a number of scope functions that put a receiver object into a new scope as either this or as an argument (e.g., it).