Skip to content

Instantly share code, notes, and snippets.

View husaynhakeem's full-sized avatar

Husayn Hakeem husaynhakeem

View GitHub Profile
/*
* Copyright (C) 2008 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Map;
import java.util.Random;
import java.util.SortedMap;
import java.util.TreeMap;
import javax.crypto.Mac;
import android.content.Context;
import com.google.gson.GsonBuilder;
import com.maketrumptweetseightagain.R;
import com.twitter.sdk.android.core.models.Tweet;
import java.util.List;
import javax.inject.Inject;
import com.twitter.sdk.android.core.models.Tweet;
import java.util.List;
import io.reactivex.Single;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface TweetsApi {
var observableData: String by Delegates.observable("Initial value") {
property, oldValue, newValue ->
println("${property.name}: $oldValue -> $newValue")
}
fun main(args: Array<String>) {
observableData = "New value"
observableData = "Another value"
}
var vetoableData: Int by Delegates.vetoable(0) {
property, oldValue, newValue ->
println("${property.name}: $oldValue -> $newValue")
newValue >= 0
}
fun main(args: Array<String>) {
vetoableData = -1
println("vetoableData = $vetoableData")
vetoableData = 1
val lazyData: Double by lazy {
println("Initializing lazyData")
2.0
}
fun main(args: Array<String>) {
println(lazyData)
println(lazyData)
}
data class Pokemon(
val name: String = "",
val type: PokemonType = PokemonType.NORMAL,
val height: Double = 0.0,
val weight: Double = 0.0
)
val pikachu = Pokemon("Pikachu", PokemonType.ELECTRIC, 0.4, 6.0)
val pikachu = Pokemon(name = "Pikachu",
type = PokemonType.ELECTRIC,
height = 0.4,
weight = 6.0
)
val (name, type, height, weight) = pikachu