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
imap jj <Esc> | |
set ignorecase | |
set smartcase |
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
@Test | |
fun kotlinMap() { | |
val testContext = InstrumentationRegistry.getTargetContext() | |
val rootView = LinearLayout(testContext) | |
listOf( | |
"www.codingstoic.com", | |
"www.codingblast.com", | |
"www.kotlinlang.org", | |
"www.android.com" |
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
val rootView = LinearLayout(testContext) | |
listOfLinks.map { | |
val tmpTextView = TextView(testContext) | |
tmpTextView.text = it | |
tmpTextView | |
}.forEach { | |
rootView.addView(it) | |
} |
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
@Test | |
fun kotlinMap() { | |
val testContext = InstrumentationRegistry.getTargetContext() | |
val listOfLinks = listOf( | |
"www.codingstoic.com", | |
"www.codingblast.com", | |
"www.kotlinlang.org", | |
"www.android.com" | |
) |
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
@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"); |
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
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", |
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
@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 |
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 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 { |
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 SecondaryConstructor(){ | |
constructor(aValue: Int) : this(){ | |
println("a second constructor") | |
} | |
constructor(aValue: Int, aSecondValue: Int) : this(aValue){ | |
println("a third constructor") | |
} | |
} |
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 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") | |
} | |
NewerOlder