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
public static CastLookup<TKey, TElement> Cast<TKey, TElement>(this ILookup<TKey, TElement> lookup) | |
{ | |
return new CastLookup<TKey,TElement>(lookup); | |
} | |
public class CastLookup<TKey, TElement> | |
{ | |
private readonly ILookup<TKey, TElement> lookup; | |
public CastLookup(ILookup<TKey, TElement> lookup) |
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
using System; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using System.Text; | |
namespace GenericBencmark | |
{ | |
class Program | |
{ |
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 syntax.flagEnums | |
private val TODO: Nothing | |
get() = throw UnsupportedOperationException() | |
public open class PatternOptions(public val value: Int = 0) { | |
// the only meaning declarations | |
public object CASE_INSENSITIVE : PatternOptions(0x02) | |
public object COMMENTS : PatternOptions(0x04) | |
public object MULTILINE : PatternOptions(0x08) |
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
public static class TestResolve | |
{ | |
public static List<T> Append<T>(this IEnumerable<T> list, T element) { throw new NotImplementedException(); } | |
public static List<T> Append<T>(this IEnumerable<T> list, IEnumerable<T> elements) { throw new NotImplementedException(); } | |
public static void Usage() | |
{ | |
var list = new List<List<String>>(); | |
var element = new List<String>(); |
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 com.google.gson.* | |
fun <T : Any> GsonBuilder.registerSingletonInstance(instance: T): GsonBuilder = | |
registerTypeAdapter(instance.javaClass, InstanceCreator { instance }) | |
fun main(args: Array<String>) { | |
// val gsonBuilder = GsonBuilder().registerTypeAdapterFactory(object : TypeAdapterFactory { | |
// override fun <T: Any> create(gson: Gson, type: TypeToken<T>): TypeAdapter<T>? { | |
// val c: Class<T> = type.rawType as Class<T> | |
// return c.kotlin.objectInstance?.let { instance -> |
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 JobCancellationInterceptor(val originalInterceptor: ContinuationInterceptor?) : | |
AbstractCoroutineContextElement(ContinuationInterceptor), | |
ContinuationInterceptor { | |
override fun <T> interceptContinuation(continuation: Continuation<T>): Continuation<T> = | |
CancellableCheckContinuation(continuation).let { | |
originalInterceptor?.interceptContinuation(it) ?: it | |
} | |
class CancellableCheckContinuation<T>(val continuation: Continuation<T>) : Continuation<T> { |