This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student( | |
val name: String?, | |
val standard: Int, | |
val rollNumber: Int | |
) { | |
private constructor(builder: Builder) : this(builder.name, builder.standard, builder.rollNumber) | |
companion object { | |
inline fun student(block: Student.Builder.() -> Unit) = Student.Builder().apply(block).build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val carDealer = CarDealer() | |
println(carDealer.getSpeed(VehicleTypes.BUS)) | |
} | |
class CarDealer { | |
val map = HashMap<VehicleTypes, Vehicle>() | |
init { | |
map.put(VehicleTypes.CAR, Car()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pickupSelected && dropSelected) return gotoNextPage() | |
var msg: String? = "Please select pickup location" | |
if (selectedTab === "PICKUP_POINT" && pickupSelected) { | |
goToDrop() | |
msg = null | |
} | |
msg = msg ?: "Please select drop location" | |
if (selectedTab === "DROP_POINT" && dropSelected) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pickupSelected && dropSelected) return gotoNextPage() | |
if (selectedTab === "PICKUP_POINT") { | |
if (pickupSelected) { | |
goToDrop(); | |
} else { | |
toast("Please select pickup location") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
if (pickupSelected && dropSelected) return gotoNextPage() | |
if (selectedTab === "PICKUP_POINT") { | |
verifyPickup(pickupSelected) | |
} | |
if (selectedTab === "DROP_POINT") { | |
verifyDropOff(dropSelected) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pickupSelected && dropSelected) { | |
return gotoNextPage(); | |
} | |
if (selectedTab === "PICKUP_POINT") { | |
if (pickupSelected) { | |
goToDrop(); | |
} else { | |
toast("Please select pickup location") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pickupSelected && dropSelected) { | |
gotoNextPage(); | |
} else if (selectedTab === "PICKUP_POINT") { | |
if (pickupSelected) { | |
goToDrop(); | |
} else { | |
toast("Please select pickup location") | |
} | |
} else { | |
if (dropSelected) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getCurrencyNameOf("UK") | |
fun getCurrencyNameOf(country: String): String { | |
return if (country == "India") { | |
"Rupee" | |
} else if (country == "USA") { | |
"Dollars" | |
} else if (country == "UK") { | |
"Euro" | |
} else if (country == "Japan") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Currency { | |
val map = HashMap<String, String>(); | |
init { | |
map.put("India", "Rupee") | |
map.put("UK", "Euro") | |
map.put("Japan", "Yen") | |
map.put("USA", "Dollar") | |
map.put("China", "Yuan") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
val intent = Intent() | |
val manufacturer = Build.MANUFACTURER | |
if ("xiaomi".equals(manufacturer, ignoreCase = true)) { | |
intent.component = ComponentName( | |
"com.miui.securitycenter", | |
"com.miui.permcenter.autostart.AutoStartManagementActivity" | |
) | |
} else if ("oppo".equals(manufacturer, ignoreCase = true)) { | |
intent.component = ComponentName( |
NewerOlder