Skip to content

Instantly share code, notes, and snippets.

sajjadyousefnia

Block or report user

Report or block sajjadyousefnia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MainActivity.java
package com.sajjady.simplegis;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.PointF;
import android.os.Bundle;
View asdffdaghjgfd.kt
val list1: List<String> = listOf("a", "b")
val list2: List<Int> = listOf(1, 2, 3)
View sdsdsdsdsd222.kt
for (element in this) {
if (element is String) {
destination.add(element)
}
}
View rewthjkhgfdscfvgbdfvdv.kt
fun hasZeros(ints: List<Int>): Boolean {
ints.forEach {
if (it == 0) return true // returns from hasZeros
}
return false
}
View asdsdasadasdasdsad2121.kt
inline fun <reified T>
Iterable<*>.filterIsInstance(): List<T>
val destination = mutableListOf<T>()
for (element in this) {
if (element is T) {
destination.add(element)
}
}
return destination
}
View sdfsfdfsdfdsfdsfdsfdsssfdsfds.kt
>>> val items = listOf("one", 2, "three")
>>> println(items.filterIsInstance<String>())
[one, three]
View asasasajjj.kt
inline fun <reified T> isA(value: Any) = value is T
>>> println(isA<String>("abc"))
true
>>> println(isA<String>(123))
false
You can’t perform that action at this time.