Posts

Showing posts from November, 2023

Smart cast operator in kotlin | "is" operator in kotlin | #shorts

Image

Typecast difference in java and kotlin | Automatic casting in java

Image

Capitalize the sentence in kotlin | replaceFirstChar() instead of capitalize

Image

Remove duplicate words from the sentence using LinkedHashSet in kotlin

Image

replaceBefore() function in kotlin

Image

replaceFirst() method in kotlin | #shorts #beginners #kotlin

Image

Replace char in kotlin | #shorts #beginners #kotlin

Image

Replace the digit to character using RegEx | #shorts #beginners #kotlin

Image

Replace substring in sentence using ignorecase | kotlin replace | #short...

Image

Ascending and Descending order in Kotlin | Sort in Kotlin | #shorts #beg...

Image

Switch case in kotlin

Mutable vs Immutable list in kotlin | #shorts @androidmani #kotlin #begi...

Image

forEach vs forEachIndex vs WithIndex in Kotlin | #shorts #beginners #kotlin

Image

NULL check in kotlin using let function | Scope function in kotlin #shor...

Image

Smart casting operator "is" and "!is" in kotlin

  fun main (args: Array<String>) { /* Smart Cast for nullable types is - !is - operator */ val obj: Any = 10 if (obj !is Long) { println ( "Obj is not string" ) } else { println ( "Obj is Long ${ obj } " ) } }

Type cast operator "as" in kotlin

  fun main (args: Array<String>) { /* Type casting in kotlin unsafe vs safe cast operator as - as? */ val obj: Any? = null val name: String? = obj as? String println (name) }

Type conversion in Kotlin vs Java

Type conversion in Kotlin vs Java In Java, The data type is automatically converted to another data type but In Kotlin we need to explicitly convert the data type like toInt(), toLong(), toString() More Type cast methods in Kotlin toChar() - To convert a data tye to Char type toInt() - To convert a data type to Int type toLong() - To convert a data type to Long type toFloat() - To convert a data type to Float type toDouble() - To convert a data type to Double type toByte() - To convert a data type to Byte type toShort() - To convert a data type to Short type Example in Java Int is automatically converted to a Long data type as long is larger than int. public class Demo { // Type casting Java public static void main (String[] args) { int a = 10 ; long b = a; System. out .println(a); System. out .println(b); } } In Kotlin the conversion is not automatic, we need to explicitly do the type conversion. Example in Kotlin fun main (args: Array<

Capitalize the each words in sentence of kotlin (Capitalize method getting deprecated)

 

Capitalize Sentence with replaceFirstChar method (Capitalize getting deprecated)

 

Remove duplicate word from sentence using LinkedHashSet in Kotlin

Kotlin replace function in String class

Normal vs Lambda expression or Highorder function

Lambda definition: Kotlin has concise (short) syntax for defining lambda functions, which makes it easier to work with functional programming constructs. Lambda Expression syntax in Kotlin: { argument -> businessloginwith_return } { a, b -> a+b } Lambda 

Mutable and Immutable List in Kotlin

Immutable List can't be editable like add, edit or delete but we can retrieve the data Mutable List can be editable by add, edit, or delete

Fibonacci Sequence using Swap in Kotlin

Image

Fibonacci Sequence using Recursive in Kotlin | #shorts #kotlin

Image

Typescript | Basics of typescript #typescript

Image