Skip to content

Instantly share code, notes, and snippets.

@AhmedMaad
Created January 10, 2024 15:23
Show Gist options
  • Save AhmedMaad/832ebffa9a3c21ed914398034b81b664 to your computer and use it in GitHub Desktop.
Save AhmedMaad/832ebffa9a3c21ed914398034b81b664 to your computer and use it in GitHub Desktop.
How to implement the search functionality in a Kotlin program that has a data source of some array elements
fun main(args: Array<String>) {
val searchElements = arrayOf(
"Android Upside down cake",
"function",
"class",
"object",
"inheritance",
"polymorphism",
"loop",
"condition",
"data type",
"array",
"list",
"map",
"set",
"algorithm",
"data structure",
"stack",
"queue",
"object-oriented programming",
"encapsulation",
"abstraction",
"inheritance",
"polymorphism",
"functional programming",
"immutable",
"lambda",
"ANDROID TRAINING",
"design pattern",
"singleton",
"factory",
"adapter",
"observer",
"testing",
"unit test",
"Glass Testing",
"Black Box testing",
"Logcat",
"debugging",
"exceptions",
"AnDrOiD Development",
"activity",
"fragment",
"view",
"layout",
"resource",
"lifecycle",
"onCreate",
"intent",
"explicit intent",
"implicit intent",
"broadcast receiver",
"permission",
"Manifest",
"runtime permission",
"location",
"camera",
"thread",
"Handler",
"AsyncTask",
"Coroutines",
"network",
"HTTP",
"REST API",
"JSON",
"Volley",
"Retrofit",
"database",
"SQLite",
"Room",
"Realm",
"Firebase",
"variable",
"testing",
"Espresso",
"JUnit",
"Android Glide GitHub",
"deployment",
"Gradle",
"Android Studio",
"Play Store",
"Maad Coding channel",
"Kotlin",
"Jetpack",
"Material Design",
"Studio Bot",
"Google Play",
"Stack Overflow",
"GitHub",
"Android Nougat",
"developer conference",
"Modern aNdRoId Development",
"Gemini API",
"Compose",
"AR/VR",
"Shared Preferences",
"Elvis Operator",
"Android Emulator",
"Recycler View android",
"problem-solving",
"learning android",
"Adapter",
)
for (element in searchElements){
if (element.lowercase().contains("android"))
println("Search result: $element")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment