Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Abdurahman Adilovic abdurahmanadilovic

🏠
Working from home
View GitHub Profile
View .ideavimrc
imap jj <Esc>
set ignorecase
set smartcase
View KotlinMapForEach.kt
@Test
fun kotlinMap() {
val testContext = InstrumentationRegistry.getTargetContext()
val rootView = LinearLayout(testContext)
listOf(
"www.codingstoic.com",
"www.codingblast.com",
"www.kotlinlang.org",
"www.android.com"
View KotlinMap2.kt
val rootView = LinearLayout(testContext)
listOfLinks.map {
val tmpTextView = TextView(testContext)
tmpTextView.text = it
tmpTextView
}.forEach {
rootView.addView(it)
}
View KotlinMap.kt
@Test
fun kotlinMap() {
val testContext = InstrumentationRegistry.getTargetContext()
val listOfLinks = listOf(
"www.codingstoic.com",
"www.codingblast.com",
"www.kotlinlang.org",
"www.android.com"
)
@abdurahmanadilovic
abdurahmanadilovic / JavaMap.java
Created Jan 28, 2018
Java manual map showcase
View JavaMap.java
@Test
public void JavaMap() throws Exception{
List<String> listOfLinks = new ArrayList<>();
Context testContext = InstrumentationRegistry.getTargetContext();
listOfLinks.add("www.codingstoic.com");
listOfLinks.add("www.codingblast.com");
listOfLinks.add("www.kotlinlang.org");
listOfLinks.add("www.android.com");
View KotlinFilterExtension.kt
import org.junit.Test
import org.junit.Assert.*
class KotlinStandardLibraryTests{
@Test
fun testFilterExtensionFunction(){
val listOfLinks = listOf(
"www.codingstoic.com",
"www.codingblast.com",
"www.kotlinlang.org",
View FilterList.java
@Test
public void testListFiltering() throws Exception{
List<String> listOfLinks = new ArrayList<>();
listOfLinks.add("www.codingstoic.com");
listOfLinks.add("www.codingblast.com");
listOfLinks.add("www.kotlinlang.org");
listOfLinks.add("www.android.com");
// filter all domains with .com domain
@abdurahmanadilovic
abdurahmanadilovic / OrderOfExecution.kt
Created Jan 27, 2018
Kotlin class order or execution
View OrderOfExecution.kt
class OrderOfExecution(name: String) {
val firstProperty = "First property: $name".also(::println)
init {
println("First initializer block that prints ${name}")
}
val secondProperty = "Second property: ${name.length}".also(::println)
init {
@abdurahmanadilovic
abdurahmanadilovic / MultipleConstructros.kt
Last active Jan 27, 2018
Kotlin multiple secondary constructors
View MultipleConstructros.kt
class SecondaryConstructor(){
constructor(aValue: Int) : this(){
println("a second constructor")
}
constructor(aValue: Int, aSecondValue: Int) : this(aValue){
println("a third constructor")
}
}
View KotlinInitBlock.kt
class Person(val firstName: String){
val blog = "www.codingstoic.com"
val city = "Sarajevo"
init{
println("by $firstName")
println("inside init block")
println("blog is $blog and city is $city")
}
You can’t perform that action at this time.