you can see part 1
deconstruct an object into a series of variables. A destructive declaration will create multiple variables at the same time.
data class Person(val title: String, val age: Int)
val person = Person(title, age)
val (title, age) = person
A destructive declaration is compiled into the following code:
val name = person.component1()
val age = person.component2()
Anything can be placed to the right of the destructor declaration as long as the required number of component functions can be called. Of course, there can be
component4（）and many more.
Destructuring statements can also be used in loops
you should use…
Kotlin said I don’t have ternary operator, it’s bad for readabilit
? :The Elvis operator is part of many programming languages, e.g. Kotlin but also Groovy or C#. may be unclear if you're not familiar with the syntax already.
ifor when in Kotlin is not a statement but an expression (i.e. it evaluates to a value),
if (condition) exp1 else exp2
if (a) b else c
in the case where you have multiple statements inside the body of an
1- what is Interface and its property ?
2- why an interface can’t store the state?
3- How to Implement interface property in Concrete type ?
4- what happen if class implement multiple interface and both the interfaces have the same functions ?
5- interface difference in Java and Kotlin
6- Functional interfaces(SAM Single Abstract Method)
7- Use a lambda in place of a functional interface?
8- Why use Object Expressions to instiate anonymous interface ?
9- Functional interfaces vs. type aliases ?
10- why can’t use Generic inside Interface Declaration ?
11- default function implementation of interface ?
1- passing data between two activities
2- Passing data between two fragments
3- Passing data between Activity and Fragment
I was asked this Question in interview 😅😅
val i:Intent =Intent(getApplicationContext(), NewActivity.class)
DataHolder and Hashmap
if you have a lot of arguments and/or complex objects you wish to move from one place to the…
1- examples that need factory design pattern ..
2- what is factory design pattern ?
3- When to use Factory design pattern ?
4- Advantage of Factory Design Pattern ?
5- How it should be implemented without Factory Design pattern ?
6- implementation with Factory method pattern ?
7- Disadvantage without using Factory Design Pattern?
8- Advantage with Factory method pattern
9- Relations with Other Patterns
10- Are Factory Design Pattern Concern with Complex object like builder?
when take about factory we will take about 3 pattern
1- static method factory (like we made in Singleton)
2- factory method (this article)
1 - what is Builder Design Pattern
2 - when we had to use Builder Design Pattern ?
3 - some built in class we use in android studio that use Builder pattern ?
4 - How do we create a Builder in kotlin ?
5 - Fluent Interface with Builder Pattern in kotlin
6 - disadvantage of Builder Pattern?
7 - avoid builder pattern in kotlin
8 - advantages of named parameters over builder?
9 - Situation you need builder over named argument ?
10- Builder Pattern vs Kotlin DSL
Builder design pattern is…
1- singleton design pattern and its rule.
2- way to make singleton thread-safe
3- implementation in Kotlin without object keyword and the magic of object
3- how to Call Kotlin object Singleton in java class
4- Kotlin object property.
5- tricky ways to handle singleton when need to pass args to param
6- when it is not recommended to use object ?
7- android real example you do in your app (retrofit and sharedPref)
The singleton pattern is a design pattern that restricts the instantiation of a class to one object. …
Notes here i won’t make blog for the implementation for each of this
1- is my app can success without clean architecture?
2- ideal clean architecture meaning ?
3- mvvm over mvp and The opposite ?
4- can i combine both in one project?
5- when i use mvvm and mvp ?
be relax :)
here Telegram Project you can check if and tell me if it use mvp or mvc or mvvm but don’t mean i told you not make no architecture i will say when should i don’t use architecture later