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.Scanner; | |
/** | |
* | |
* @author Niloy | |
*/ | |
public class Main { | |
public static void main(String[] args) { |
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.concurrent.LinkedBlockingQueue | |
import java.util.concurrent.ThreadPoolExecutor | |
import java.util.concurrent.TimeUnit | |
import kotlin.random.Random.Default.nextInt | |
/* | |
* Here queue size is defined 3 | |
* so that means if the tasks in the queue exceeds 3 then the pool will create |
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.io.Serializable | |
data class Quadruple<A,B,C,D>(var first: A, var second: B, var third: C, var fourth: D): Serializable { | |
override fun toString(): String = "($first, $second, $third, $fourth)" | |
} |
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 Event<out R>(private val data: R) { | |
var hasEventBeenHandled = false | |
private set | |
val content: R? | |
get() = if (!hasEventBeenHandled) { | |
hasEventBeenHandled = true | |
data | |
} else { |
git remote add <origin_name> <url_of_the_remote_repo>
git remote set-url <origin> <url_of_the_remote_repo>
git remote
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 android.content.Context | |
import android.net.ConnectivityManager | |
import android.net.Network | |
import android.net.NetworkCapabilities | |
import android.net.NetworkRequest | |
import android.os.Build | |
import androidx.lifecycle.LiveData | |
import androidx.lifecycle.MutableLiveData | |
/** |
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 android.Manifest; | |
import android.annotation.SuppressLint; | |
import android.app.Activity; | |
import android.content.IntentSender; | |
import android.content.pm.PackageManager; | |
import android.os.Looper; | |
import androidx.core.app.ActivityCompat; | |
import androidx.lifecycle.Lifecycle; | |
import androidx.lifecycle.LifecycleObserver; |
OlderNewer