Clone class 0:
https://github.com/Ilya1998/KotlinAsFirst2016/blob/master/src/lesson4/task1/List.kt#L242-L258
https://github.com/KuzinaMari/KotlinAsFirst2016/blob/master/src/lesson4/task1/List.kt#L296-L312
Clone class 1:
https://github.com/Perepicica/KotlinAsFirst2016/blob/master/src/lesson5/task1/Parse.kt#L103-L121
https://github.com/malashik35/KotlinAsFirst2016/blob/master/src/lesson5/task1/Parse.kt#L103-L121
Clone class 2:
https://github.com/IgorLo/KotlinAsFirst2016/blob/master/src/lesson5/task1/Parse.kt#L107-L125
https://github.com/SeveNChaK/KotlinAsFirst2016/blob/master/src/lesson5/task1/Parse.kt#L102-L119
Clone class 3:
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
package ru.spbstu.util; | |
import java.util.function.BiFunction; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
import java.util.function.Consumer; | |
<% | |
def k = number | |
def formattedList = { format, range -> range.collect{String.format(format, it)} } | |
def formatted = { format, range -> formattedList(format, range).join(", ") } |
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
package ru.spbstu.util; | |
<% | |
def k = number | |
def formattedList = { format, range -> range.collect{String.format(format, it)} } | |
def formatted = { format, range -> formattedList(format, range).join(", ") } | |
%> | |
import java.util.Objects; | |
import java.util.Optional; | |
import java.util.function.Function; | |
import java.util.function.Consumer; |
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
package kotlinPlay | |
fun <S, T: S> Iterable<T>.reduceWithDefault(default: S, operation: (S, T) -> S): S = | |
if(this.any()) this.reduce(operation) else default | |
interface JsonElement {} | |
data class StringJsonElement(val v: String): JsonElement{} | |
data class DoubleJsonElement(val v: Double): JsonElement{} | |
data class ArrayJsonElement(val elements: Array<out JsonElement>): JsonElement{} | |
data class ObjectJsonElement(val v: Map<String, JsonElement>): JsonElement{} |
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 java.util.* | |
import kotlin.properties.Delegates | |
interface Location{ | |
fun consume(ch: Char): Location | |
} | |
data class SimplestLocation(val position: Int): Location { | |
override fun consume(ch: Char) = SimplestLocation(position + 1) | |
} |
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
package ru.spbstu | |
import java.lang.reflect.GenericArrayType | |
import java.lang.reflect.ParameterizedType | |
import java.lang.reflect.Type | |
import java.lang.reflect.WildcardType | |
import java.util.* | |
import java.util.stream.Stream | |
import kotlin.reflect.KCallable | |
import kotlin.reflect.KClass |
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
#include <cstdint> | |
#include <vector> | |
#include <limits> | |
#include <cstring> | |
#include <iostream> | |
#include <string> | |
#include <type_traits> | |
#include <cstring> |
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
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME) | |
@kotlin.annotation.Target(AnnotationTarget.TYPE) | |
annotation class Whatever | |
fun main(args: Array<String>) { | |
val example = ({x: @Whatever Int ->}) | |
} |
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
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME) | |
@kotlin.annotation.Target(AnnotationTarget.VALUE_PARAMETER) | |
annotation class Whatever | |
fun main(args: Array<String>) { | |
fun local(@Whatever x : Int) {} | |
println(::local.reflect()?.parameters?.first()?.annotations?.size) // prints 0 | |
} |
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
data class UncookedAnnotation(val name: String, val params: Map<String, Any?>) | |
val KType.uncookedAnnotations | |
get() = this.kotlinType.annotations.map { desc -> | |
UncookedAnnotation( | |
kotlin.reflect.jvm.internal.impl.renderer.DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(desc.type), | |
desc.allValueArguments.asSequence().map { (k, v) -> Pair("${k.name}", v.value) }.toMap() | |
) | |
} |
OlderNewer