Programming Kotlin Applications. Бретт Мак-Лахлин
Чтение книги онлайн.

Читать онлайн книгу Programming Kotlin Applications - Бретт Мак-Лахлин страница 2

Название: Programming Kotlin Applications

Автор: Бретт Мак-Лахлин

Издательство: John Wiley & Sons Limited

Жанр: Программы

Серия:

isbn: 9781119696216

isbn:

СКАЧАТЬ DATA CLASS TAKES THE WORK OUT OF A CLASS FOCUSED ON DATA DESTRUCTURING DATA THROUGH DECLARATIONS YOU CAN “COPY” AN OBJECT OR MAKE A COPY OF AN OBJECT DATA CLASSES REQUIRE SEVERAL THINGS FROM YOU DATA CLASSES ADD SPECIAL BEHAVIOR TO GENERATED CODE DATA CLASSES ARE BEST LEFT ALONE

      17  9 Enums and Sealed, More Specialty Classes STRINGS ARE TERRIBLE AS STATIC TYPE REPRESENTATIONS COMPANION OBJECTS ARE SINGLE INSTANCE ENUMS DEFINE CONSTANTS AND PROVIDE TYPE SAFETY SEALED CLASSES ARE TYPE-SAFE CLASS HIERARCHIES

      18  10 Functions and Functions and Functions REVISITING THE SYNTAX OF A FUNCTION FUNCTIONS FOLLOW FLEXIBLE RULES FUNCTIONS IN KOTLIN HAVE SCOPE FUNCTION LITERALS: LAMBDAS AND ANONYMOUS FUNCTIONS LOTS OF FUNCTIONS, LOTS OF ROOM FOR PROBLEMS

      19  11 Speaking Idiomatic Kotlin SCOPE FUNCTIONS PROVIDE CONTEXT TO CODE USE LET TO PROVIDE IMMEDIATE ACCESS TO AN INSTANCE WITH IS A SCOPE FUNCTION FOR PROCESSING AN INSTANCE RUN IS A CODE RUNNER AND SCOPE FUNCTION APPLY HAS A CONTEXT OBJECT BUT NO RETURN VALUE ALSO GIVES YOU AN INSTANCE … BUT OPERATES ON THE INSTANCE FIRST SCOPE FUNCTIONS SUMMARY

      20  12 Inheritance, One More Time, with Feeling ABSTRACT CLASSES REQUIRE A LATER IMPLEMENTATION INTERFACES DEFINE BEHAVIOR BUT HAVE NO BODY DELEGATION OFFERS ANOTHER OPTION FOR EXTENDING BEHAVIOR INHERITANCE REQUIRES FORETHOUGHT AND AFTERTHOUGHT

      21  13 Kotlin: The Next Step PROGRAMMING KOTLIN FOR ANDROID KOTLIN AND JAVA ARE GREAT COMPANIONS WHEN KOTLIN QUESTIONS STILL EXIST NOW WHAT?

      22  INDEX

      23  END USER LICENSE AGREEMENT

      List of Tables

      1 Chapter 2TABLE 2.1: Kotlin Types for Integers (Nondecimal Numbers)TABLE 2.2: Kotlin Types for Decimal Numbers

      2 Chapter 6TABLE 6.1: Differences between Covariant and Contravariant

      3 Chapter 11TABLE 11.1: Differences between scope functions

      List of Illustrations

      1 Chapter 1FIGURE 1.1 Download IntelliJ from the JetBrains download page.FIGURE 1.2 IntelliJ comes prepackaged with a system-specific installation pr...FIGURE 1.3 You'll generally be either creating a project from scratch or imp...FIGURE 1.4 IntelliJ makes getting going in Kotlin simple and prompts you on ...FIGURE 1.5 Kotlin code should go in the src/ folder.FIGURE 1.6 IntelliJ automatically formats code and adds sensible syntax high...FIGURE 1.7 You can click the green Run button and select the first option to...FIGURE 1.8 The empty output of your program (which will soon be non-empty) d...FIGURE 1.9 Good IDEs help you quickly find and fix errors.FIGURE 1.10 Why doesn't this override of toString() work?

      2 Chapter 2FIGURE 2.1 Your IDE should let you easily get to your source code as well as...FIGURE 2.2 Moving a class to a new package is basically a refactoring, which...FIGURE 2.3 Person is now nested under its containing package.FIGURE 2.4 IDEs will help you keep constructor properties straight.

      3 Chapter 4FIGURE 4.1 Code from Person expanded completelyFIGURE 4.2 You can collapse code blocks to the { … } form in your IDEFIGURE 4.3 Toggle between expanded and collapsed with the + and – icons

      4 Chapter 5FIGURE 5.1 Collection and several related classes

      5 Chapter 7FIGURE 7.1 An if statement adjusts how your code is executed and the flow of...FIGURE 7.2 Program execution has two different flows in this example.

      6 Chapter 10FIGURE 10.1 A function always has the same basic parts.FIGURE 10.2 A good IDE gives you default values for a function, even from a ...FIGURE 10.3 IDEs help with arguments, especially if you're naming arguments ...FIGURE 10.4 An unused anonymous functionFIGURE 10.5 A function assigned to a variable is СКАЧАТЬ