Skip to content

Instantly share code, notes, and snippets.

View abdurahmanadilovic's full-sized avatar
🏠
Working from home

Abdurahman Adilovic abdurahmanadilovic

🏠
Working from home
View GitHub Profile
@abdurahmanadilovic
abdurahmanadilovic / .ideavimrc
Created September 12, 2019 08:10
Idea vim rc
imap jj <Esc>
set ignorecase
set smartcase
@abdurahmanadilovic
abdurahmanadilovic / KotlinMapForEach.kt
Created January 28, 2018 12:32
Kotlin map forEach example
@Test
fun kotlinMap() {
val testContext = InstrumentationRegistry.getTargetContext()
val rootView = LinearLayout(testContext)
listOf(
"www.codingstoic.com",
"www.codingblast.com",
"www.kotlinlang.org",
"www.android.com"
@abdurahmanadilovic
abdurahmanadilovic / KotlinMap2.kt
Created January 28, 2018 12:30
Kotlin map example 2
val rootView = LinearLayout(testContext)
listOfLinks.map {
val tmpTextView = TextView(testContext)
tmpTextView.text = it
tmpTextView
}.forEach {
rootView.addView(it)
}
@abdurahmanadilovic
abdurahmanadilovic / KotlinMap.kt
Created January 28, 2018 12:22
Kotlin map example
@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 January 28, 2018 12:12
Java manual map showcase
@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");
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",
@abdurahmanadilovic
abdurahmanadilovic / FilterList.java
Created January 28, 2018 11:29
Java filter functions
@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 January 27, 2018 07:43
Kotlin class order or execution
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 January 27, 2018 07:34
Kotlin multiple secondary constructors
class SecondaryConstructor(){
constructor(aValue: Int) : this(){
println("a second constructor")
}
constructor(aValue: Int, aSecondValue: Int) : this(aValue){
println("a third constructor")
}
}
@abdurahmanadilovic
abdurahmanadilovic / KotlinInitBlock.kt
Last active January 27, 2018 06:56
Kotlin init block
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")
}