I hereby claim:
- I am valux on github.
- I am alv0 (https://keybase.io/alv0) on keybase.
- I have a public key ASCV5ZTcLFXDeVXVknrSseuZP24VD-YPaXw2WEEbxYQcbAo
To claim this, I am signing this object:
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collection; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReadWriteLock; | |
import java.util.concurrent.locks.ReentrantReadWriteLock; | |
import java.util.stream.IntStream; |
import java.util.ArrayDeque; | |
import java.util.Arrays; | |
import java.util.Collection; | |
import java.util.Iterator; | |
import java.util.Objects; | |
import java.util.Queue; | |
import java.util.Spliterator; | |
import java.util.function.Consumer; | |
import java.util.stream.Stream; | |
import java.util.stream.StreamSupport; |
/** | |
* Basic folding of the specified iterable source seeded with initial value and accumulated by the | |
* provided operation | |
*/ | |
public static <T, R> R fold(final Iterable<T> source, | |
final R initial, | |
final BiFunction<R, T, R> operation) { | |
var accumulator = initial; | |
for (T element : source) { |
/** | |
* Will extract nested property from value, if it is not null | |
* | |
* @param value source value | |
* @param extractor extractor function for getting desired nested property from value. | |
* @param <A> type of the source value | |
* @param <B> type of the target nested property | |
* @return target nested property from value or null. | |
*/ | |
public static <A, B> B getOrNull(A value, Function<A, B> extractor) { |
I hereby claim:
To claim this, I am signing this object:
import java.util.Objects; | |
import java.util.function.Consumer; | |
import java.util.function.Function; | |
/** | |
* Represents a value of one of two possible types (a disjoint union.) | |
* An instance of Either is either an instance of <code>left</code> or <code>right</code>. | |
* e.g.: Can contain the value of type L OR R in the same time. | |
* | |
* @param <L> Type parameter of first(LEFT) value. |
object Test extends App { | |
val processCommand: String => List[Int] => List[Int] = { | |
case "add" => { | |
case a :: b :: tail => a + b :: tail | |
case _ => Nil | |
} | |
case "sub" => { | |
case a :: b :: tail => a - b :: tail | |
case _ => Nil |
import org.junit.Assert; | |
import org.junit.Test; | |
import java.util.Arrays; | |
import java.util.HashMap; | |
public class AnagramTest { | |
private final HashMap<String, Integer> dictionary = |
final EditText txt = new EditText(this); | |
new AlertDialog.Builder(this) | |
.setTitle("Title") | |
.setView(txt) | |
.setPositiveButton("Ok", new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int whichButton) { | |
String url = txtUrl.getText().toString(); | |
//do smth. with it. | |
} | |
}) |