Created
January 28, 2018 12:22
-
-
Save abdurahmanadilovic/e2e1ecd0ee2c69f8c96ea0ae2915c1c2 to your computer and use it in GitHub Desktop.
Kotlin map example
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" | |
) | |
val listOfTextViews = listOfLinks.map { | |
val tmpTextView = TextView(testContext) | |
tmpTextView.text = it | |
tmpTextView | |
} | |
val rootView = LinearLayout(testContext) | |
listOfTextViews.forEach { | |
rootView.addView(it) | |
} | |
assertEquals(listOfLinks[0], listOfTextViews[0].text.toString()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment