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 frank { | |
if (i= == 4) { | |
do something | |
} | |
} |
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
enum class TimeUnit(val name: String, val divisorFromNanos: Long, val precision: Int) { | |
Seconds : TimeUnit("seconds", 1000000000, 2) | |
Millis : TimeUnit("millis", 1000000, 0) | |
Micros : TimeUnit("micros", 1000, 0) | |
Nanos : TimeUnit("nanos", 1, 0) | |
fun toHumanReadable(nanoTime: Long): String = "%.${precision}f ${name}".format(nanoTime.toFloat() / divisorFromNanos.toFloat()) | |
} | |
class Duration(val duration: Long, val units: TimeUnit, private val durationInNanos: Long = duration * units.divisorFromNanos) : Comparable<Duration> { |
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 com.collokia.webapp.routes; | |
import io.netty.handler.codec.http.HttpHeaders; | |
import io.vertx.core.net.SocketAddress; | |
import io.vertx.ext.web.RoutingContext; | |
import io.vertx.ext.web.Session; | |
import sun.reflect.generics.reflectiveObjects.NotImplementedException; | |
import javax.servlet.*; |
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 Fred : AutoCloseable { | |
override fun close() { | |
} | |
} | |
public fun foo() { | |
Fred().use { | |
// do something then autoclose |
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
// Shown from the Java 8 JDK source code, only comments removed. | |
public static <T> | |
Collector<T, ?, IntSummaryStatistics> summarizingInt(ToIntFunction<? super T> mapper) { | |
return new CollectorImpl<T, IntSummaryStatistics, IntSummaryStatistics>( | |
IntSummaryStatistics::new, | |
(r, t) -> r.accept(mapper.applyAsInt(t)), | |
(l, r) -> { l.combine(r); return l; }, CH_ID); | |
public class IntSummaryStatistics implements IntConsumer { | |
private long count; |
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 com.google.classyshark.silverghost.translator.dex | |
object DexlibAdapter { | |
val primitiveTypes = mapOf( | |
"I" to "int", | |
"V" to "void", | |
"C" to "char", | |
"D" to "double", | |
"F" to "float", | |
"J" to "long", |
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
@file:Suppress("NOTHING_TO_INLINE") | |
import java.io.BufferedReader | |
import java.io.File | |
import java.io.InputStream | |
import java.io.InputStreamReader | |
import kotlin.system.measureTimeMillis | |
// Kotlin 1.2.0 (probably 1.6.0 will work as well) | |
// |
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
func submit() { | |
guard let name = nameField.text else { | |
show("No name to submit") | |
return | |
} | |
guard let address = addressField.text else { | |
show("No address to submit") | |
return | |
} |