chore: sync content to repo (#10131)
Co-authored-by: nilbuild <4921183+nilbuild@users.noreply.github.com>
This commit is contained in:
1 parent
39948a7fec
commit
34c4aa4862
23 files changed
+33
-51
No files matched your search
@@ -1,7 +1,6 @@
|
||||
# AI Development
|
||||
|
||||
Kotlin provides a modern and pragmatic foundation for building AI-powered applications.
|
||||
It can be used across platforms, integrates well with established AI frameworks, and supports common AI development patterns through its AI agentic framework, Koog. There are many use cases where Kotlin can help with AI development, from integrating language models into backend services to building AI-powered user interfaces.
|
||||
Kotlin provides a modern and pragmatic foundation for building AI-powered applications. It can be used across platforms, integrates well with established AI frameworks, and supports common AI development patterns through its AI agentic framework, Koog. There are many use cases where Kotlin can help with AI development, from integrating language models into backend services to building AI-powered user interfaces.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ Android Jetpack is a suite of libraries, tools, and architectural guidance desig
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@article@Kotlin for Jetpack](https://developer.android.com/develop/ui/compose/kotlin)
|
||||
- [@course@Android Basics with Compose](https://developer.android.com/courses/android-basics-compose/course)
|
||||
- [@course@Android Basics with Compose](https://developer.android.com/courses/android-basics-compose/course)
|
||||
- [@article@Kotlin for Jetpack](https://developer.android.com/develop/ui/compose/kotlin)
|
||||
@@ -5,5 +5,5 @@ The Android SDK (Software Development Kit) is a set of tools, libraries, documen
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@official@Kotlin for Android](https://kotlinlang.org/docs/android-overview.html)
|
||||
- [@article@Develop Android apps with Kotlin](https://developer.android.com/kotlin)
|
||||
- [@official@Android & Kotlin Development Masterclass – Full Course](https://www.youtube.com/watch?v=blKkRoZPxLc&ab_channel=freeCodeCamp.org)
|
||||
- [@official@Android & Kotlin Development Masterclass – Full Course](https://www.youtube.com/watch?v=blKkRoZPxLc&ab_channel=freeCodeCamp.org)
|
||||
- [@article@Develop Android apps with Kotlin](https://developer.android.com/kotlin)
|
||||
@@ -4,6 +4,6 @@ Android Studio is the official Integrated Development Environment (IDE) for Andr
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@course@Introduction to programming in Kotlin](https://developer.android.com/courses/pathways/android-basics-compose-unit-1-pathway-1)
|
||||
- [@official@Kotlin for Android](https://kotlinlang.org/docs/android-overview.html)
|
||||
- [@article@Develop Android apps with Kotlin](https://developer.android.com/kotlin)
|
||||
- [@course@Introduction to programming in Kotlin](https://developer.android.com/courses/pathways/android-basics-compose-unit-1-pathway-1)
|
||||
- [@article@Develop Android apps with Kotlin](https://developer.android.com/kotlin)
|
||||
@@ -1,6 +1,6 @@
|
||||
# Characters
|
||||
|
||||
Characters in Kotlin represent single symbols, like letters, numbers, or punctuation marks. They are denoted by the `Char` type and are enclosed in single quotes (e.g., `'A'`, `'7'`, `'$'`). You can use characters to store and manipulate individual text elements within your programs. Kotlin supports Unicode characters, allowing you to represent a wide range of symbols from different languages.
|
||||
Characters in Kotlin represent single symbols, like letters, numbers, or punctuation marks. They are denoted by the `Char` type and are enclosed in single quotes (e.g., `'A'`, `'7'`, `'$'`). You can use characters to store and manipulate individual text elements within your programs. Kotlin supports Unicode characters, allowing you to represent a wide range of symbols from different languages.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
# Code Organization
|
||||
|
||||
In pure Kotlin projects, the recommended directory structure follows the package structure with the common root package omitted. For example, if all the code in the project is in the `org.example.kotlin` package and its subpackages, files with the `org.example.kotlin` package should be placed directly under the source root, and files in `org.example.kotlin.network.socke
|
||||
t` should be in the `network/socket` subdirectory of the source root.
|
||||
|
||||
If a Kotlin file contains a single class or interface (potentially with related top-level declarations), its name should be the same as the name of the class, with the .kt extension appended. It applies to all types of classes and interfaces. If a file contains multiple classes, or only top-level declarations, choose a name describing what the file contains, and name the file accordingly. Use upper camel case, where the first letter of each word is capitalized. For example, ProcessDeclarations.kt
|
||||
In pure Kotlin projects, the recommended directory structure follows the package structure with the common root package omitted. For example, if all the code in the project is in the `org.example.kotlin` package and its subpackages, files with the `org.example.kotlin` package should be placed directly under the source root, and files in `org.example.kotlin.network.socke t` should be in the `network/socket` subdirectory of the source root.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Coroutines Best Practices
|
||||
|
||||
Coroutines in Kotlin simplify asynchronous programming, but using them effectively requires following certain best practices. These include using structured concurrency to manage coroutine lifecycles and prevent leaks, avoiding `GlobalScope` for most tasks and preferring `CoroutineScope` tied to specific components, handling exceptions properly within coroutines, and offloading long-running or blocking operations to appropriate dispatchers like `Dispatchers.IO` to avoid blocking the main thread. Additionally, it's important to cancel coroutines when they are no longer needed to free up resources and prevent unnecessary work.
|
||||
Coroutines in Kotlin simplify asynchronous programming, but using them effectively requires following certain best practices. These include using structured concurrency to manage coroutine lifecycles and prevent leaks, avoiding `GlobalScope` for most tasks and preferring `CoroutineScope` tied to specific components, handling exceptions properly within coroutines, and offloading long-running or blocking operations to appropriate dispatchers like `Dispatchers.IO` to avoid blocking the main thread. Additionally, it's important to cancel coroutines when they are no longer needed to free up resources and prevent unnecessary work.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Date & Time
|
||||
|
||||
Kotlin leverages Java's `java.time` package (introduced in Java 8) for handling dates and times, offering classes like `LocalDate`, `LocalTime`, and `LocalDateTime`. Kotlin also provides extensions and convenience functions within its standard library, such as the kotlinx.datetime library, to work with dates and times. This allows you to easily represent, manipulate, and format date and time information in your Kotlin applications.
|
||||
Kotlin leverages Java's `java.time` package (introduced in Java 8) for handling dates and times, offering classes like `LocalDate`, `LocalTime`, and `LocalDateTime`. Kotlin also provides extensions and convenience functions within its standard library, such as the kotlinx.datetime library, to work with dates and times. This allows you to easily represent, manipulate, and format date and time information in your Kotlin applications.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@opensource@kotlinx.datetime](https://github.com/Kotlin/kotlinx-datetime)
|
||||
- [@official@Time measurement](https://kotlinlang.org/docs/time-measurement.html)
|
||||
- [@official@java.time](https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html)
|
||||
- [@opensource@kotlinx.datetime](https://github.com/Kotlin/kotlinx-datetime)
|
||||
- [@video@The Full Guide About the DateTime API in Kotlin](https://www.youtube.com/watch?v=gzHy6wKAJh8)
|
||||
@@ -1,9 +1,10 @@
|
||||
# Defining Classes
|
||||
|
||||
In Kotlin, a class is a blueprint for creating objects (instances). You define a class using the `class` keyword, followed by the class name and curly braces. A class consists of three major parts:
|
||||
* Properties. Variables that specify the attributes of the class's objects.
|
||||
* Methods. Functions that contain the class's behaviors and actions.
|
||||
* Constructors. A special member function that creates instances of the class throughout the program in which it's defined.
|
||||
|
||||
* Properties. Variables that specify the attributes of the class's objects.
|
||||
* Methods. Functions that contain the class's behaviors and actions.
|
||||
* Constructors. A special member function that creates instances of the class throughout the program in which it's defined.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Interfaces
|
||||
|
||||
Interfaces in Kotlin are blueprints for classes, defining a set of properties and abstract methods that implementing classes must provide. They allow you to define a contract, ensuring that any class implementing the interface will have specific functionalities. Unlike classes, interfaces cannot store state; they only declare what a class *should* do, not *how* it should do it. A class can implement multiple interfaces, enabling a form of multiple inheritance of behavior.
|
||||
Interfaces in Kotlin are blueprints for classes, defining a set of properties and abstract methods that implementing classes must provide. They allow you to define a contract, ensuring that any class implementing the interface will have specific functionalities. Unlike classes, interfaces cannot store state; they only declare what a class _should_ do, not _how_ it should do it. A class can implement multiple interfaces, enabling a form of multiple inheritance of behavior.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Introduction to Kotlin
|
||||
|
||||
Kotlin is an open-source statically typed programming language that targets the JVM, Android, JavaScript, Wasm, and Native. Kotlin is an open-source, statically-typed programming language that supports both object-oriented and functional programming. It's designed to be concise, safe, and interoperable with Java, making it easy to adopt for existing Java projects. Kotlin can be used for any kind of development, be it server-side, client-side web, Android, or multiplatform library. With Kotlin/Native currently in the works, support for other platforms such as embedded systems, macOS, and iOS. People are using Kotlin for mobile and server-side applications, client-side with JavaScript or JavaFX, and data science, just to name a few possibilities.
|
||||
Kotlin is an open-source statically typed programming language that targets the JVM, Android, JavaScript, Wasm, and Native. Kotlin is an open-source, statically-typed programming language that supports both object-oriented and functional programming. It's designed to be concise, safe, and interoperable with Java, making it easy to adopt for existing Java projects. Kotlin can be used for any kind of development, be it server-side, client-side web, Android, or multiplatform library.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@official@Kotlin Docs](https://kotlinlang.org/docs/home.html)
|
||||
- [@article@Kotlin overview](https://developer.android.com/kotlin/overview)
|
||||
- [@official@Teach Computer Science with Kotlin](https://kotlinlang.org/education/)
|
||||
- [@course@Android Basics with Compose](https://developer.android.com/courses/android-basics-compose/course)
|
||||
- [@official@Kotlin Docs](https://kotlinlang.org/docs/home.html)
|
||||
- [@official@Teach Computer Science with Kotlin](https://kotlinlang.org/education/)
|
||||
- [@article@Kotlin overview](https://developer.android.com/kotlin/overview)
|
||||
- [@video@Full 2025 Kotlin Crash Course For Beginners](https://www.youtube.com/watch?v=dzUc9vrsldM)
|
||||
@@ -5,6 +5,6 @@ Kotlin leverages both its own `kotlin.io` package and the standard Java `java.io
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@official@kotlin.io](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.io/)
|
||||
- [@opensource@kotlinx.io](https://github.com/Kotlin/kotlinx-io)
|
||||
- [@official@java.io](https://docs.oracle.com/javase/tutorial/essential/io/)
|
||||
- [@opensource@kotlinx.io](https://github.com/Kotlin/kotlinx-io)
|
||||
- [@video@Working With Files In Kotlin - IO Essentials](https://www.youtube.com/watch?v=MSeI7XVzrvo)
|
||||
@@ -1,6 +1,6 @@
|
||||
# Lambda Functions
|
||||
|
||||
Lambda functions in Kotlin are essentially nameless functions that you can treat like values. Think of them as mini-functions you can pass around, store in variables, or execute directly. They're defined using curly braces `{}` and can take parameters and return a value. They're particularly useful for short, concise operations, especially when working with collections or higher-order functions (functions that take other functions as arguments).
|
||||
Lambda functions in Kotlin are essentially nameless functions that you can treat like values. Think of them as mini-functions you can pass around, store in variables, or execute directly. They're defined using curly braces `{}` and can take parameters and return a value. They're particularly useful for short, concise operations, especially when working with collections or higher-order functions (functions that take other functions as arguments).
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
# Member Functions
|
||||
|
||||
Member functions, also known as methods, are functions that are defined inside a class. They operate on the data of that class and can access its properties. You can think of them as actions that an object of that class can perform. They are declared using the `fun` keyword within the class body, just like regular functions, but they are associated with a specific class. Member functions are called with dot notation:
|
||||
`
|
||||
Sample().foo() // creates instance of class Sample and calls foo
|
||||
`
|
||||
Member functions, also known as methods, are functions that are defined inside a class. They operate on the data of that class and can access its properties. You can think of them as actions that an object of that class can perform. They are declared using the `fun` keyword within the class body, just like regular functions, but they are associated with a specific class. Member functions are called with dot notation: `Sample().foo() // creates instance of class Sample and calls foo`
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Nested & Inner Classes
|
||||
|
||||
Kotlin allows you to define classes inside other classes. A nested class is declared inside another class but doesn't have access to the outer class's instance. An inner class, on the other hand, is declared with the `inner` keyword and *does* have access to the outer class's instance members. This provides a way to logically group classes and control access to data.
|
||||
Kotlin allows you to define classes inside other classes. A nested class is declared inside another class but doesn't have access to the outer class's instance. An inner class, on the other hand, is declared with the `inner` keyword and _does_ have access to the outer class's instance members. This provides a way to logically group classes and control access to data.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
# Function Parameters
|
||||
|
||||
Function parameters are values that you pass into a function when you call it. These parameters act as inputs, allowing the function to operate on different data each time it's invoked. In Kotlin, function parameters are defined using Pascal notation - name: type. Parameters are separated using commas, and each parameter must be explicitly typed:
|
||||
`
|
||||
fun powerOf(number: Int, exponent: Int): Int { /*...*/ }
|
||||
`
|
||||
Function parameters are values that you pass into a function when you call it. These parameters act as inputs, allowing the function to operate on different data each time it's invoked. In Kotlin, function parameters are defined using Pascal notation - name: type. Parameters are separated using commas, and each parameter must be explicitly typed: `fun powerOf(number: Int, exponent: Int): Int { /*...*/ }`
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Printing Data in Kotlin: `print` and `println`
|
||||
# Printing Data in Kotlin: print and println
|
||||
|
||||
In Kotlin, `print` and `println` are fundamental functions used to display output to the console. The `print` function displays its argument without adding a newline character at the end, meaning subsequent output will appear on the same line. Conversely, the `println` function displays its argument and then adds a newline character, ensuring that the next output appears on a new line.
|
||||
|
||||
|
||||
@@ -4,6 +4,6 @@ Quarkus provides first class support for using Kotlin. The framework is open sou
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@article@Quarkus Docs](https://quarkus.io/guides/)
|
||||
- [@official@Using Kotlin with Quarkus](https://quarkus.io/guides/kotlin)
|
||||
- [@article@Quarkus Docs](https://quarkus.io/guides/)
|
||||
- [@video@Quarkus for Kotlin Developers](https://www.youtube.com/watch?v=faVGvVLWMmk)
|
||||
@@ -1,6 +1,6 @@
|
||||
# Return in Kotlin Functions
|
||||
|
||||
In Kotlin, the `return` statement is used within a function to stop its execution and send a value back to the caller. The value returned must match the function's declared return type. If a function doesn't explicitly return a value (its return type is `Unit`), the `return` statement is optional at the end of the function; otherwise, it's required to provide a value of the correct type.
|
||||
In Kotlin, the `return` statement is used within a function to stop its execution and send a value back to the caller. The value returned must match the function's declared return type. If a function doesn't explicitly return a value (its return type is `Unit`), the `return` statement is optional at the end of the function; otherwise, it's required to provide a value of the correct type.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
# Standard Functions
|
||||
|
||||
Kotlin functions are declared using the `fun` keyword.
|
||||
`
|
||||
fun double(x: Int): Int {
|
||||
return 2 * x
|
||||
}
|
||||
`
|
||||
To call a functions, just:
|
||||
`
|
||||
val result = double(2)
|
||||
`
|
||||
Kotlin functions are declared using the `fun` keyword. `fun double(x: Int): Int { return 2 * x }` To call a functions, just: `val result = double(2)`
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Type Checks & Casts
|
||||
|
||||
Kotlin allows you to check the type of a variable at runtime using the `is` operator. This operator returns `true` if a variable is of a certain type. Furthermore, Kotlin's smart casts automatically cast a variable to a more specific type within a block of code if the compiler can guarantee that the variable is of that type due to a type check. This eliminates the need for explicit casting in many situations, making the code cleaner and safer.
|
||||
Kotlin allows you to check the type of a variable at runtime using the `is` operator. This operator returns `true` if a variable is of a certain type. Furthermore, Kotlin's smart casts automatically cast a variable to a more specific type within a block of code if the compiler can guarantee that the variable is of that type due to a type check. This eliminates the need for explicit casting in many situations, making the code cleaner and safer.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# While and Do-While Loops
|
||||
|
||||
In Kotlin, `while` and `do-while` loops are used to repeatedly execute a block of code based on a condition. The `while` loop checks the condition *before* each execution of the block; if the condition is true, the block executes, and the process repeats. The `do-while` loop, on the other hand, executes the block *at least once* and then checks the condition; the block continues to execute as long as the condition remains true.
|
||||
In Kotlin, `while` and `do-while` loops are used to repeatedly execute a block of code based on a condition. The `while` loop checks the condition _before_ each execution of the block; if the condition is true, the block executes, and the process repeats. The `do-while` loop, on the other hand, executes the block _at least once_ and then checks the condition; the block continues to execute as long as the condition remains true.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Why Use Kotlin?
|
||||
|
||||
Kotlin is a modern programming language that makes coding easier and more efficient. It's designed to be simple to learn and use, helping developers write cleaner and more reliable code. Kotlin also works seamlessly with existing Java code, making it easy to integrate into current projects. Kotlin can be used for any kind of development, be it server-side, client-side web, Android, or multiplatform library. With Kotlin/Native currently in the works, support for other platforms such as embedded systems, macOS, and iOS. People are using Kotlin for mobile and server-side applications, client-side with JavaScript or JavaFX, and data science, just to name a few possibilities.
|
||||
Kotlin is a modern programming language that makes coding easier and more efficient. It's designed to be simple to learn and use, helping developers write cleaner and more reliable code. Kotlin also works seamlessly with existing Java code, making it easy to integrate into current projects. Kotlin can be used for any kind of development, be it server-side, client-side web, Android, or multiplatform library.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
|
||||
Reference in new issue
Block a user