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
[INFO] Scanning for projects... | |
[INFO] | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Building Javaslang 1.0.1-SNAPSHOT | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] | |
[INFO] --- maven-release-plugin:2.4.2:perform (default-cli) @ javaslang --- | |
[INFO] Checking out the project to perform the release ... | |
[INFO] Executing: /bin/sh -c cd /Users/daniel/git/rocketscience-projects/javaslang/target && git clone --branch javaslang-1.0.0 git@github.com:rocketscience-projects/javaslang.git /Users/daniel/git/rocketscience-projects/javaslang/target/checkout | |
[INFO] Working directory: /Users/daniel/git/rocketscience-projects/javaslang/target |
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
interface NestedFunWithLambda { | |
default String spaces(int count) { | |
final BiFunction<String, Integer, String> spaces = | |
// compiler complains that spaces may not have been initialized | |
(s, i) -> (i < 1) ? s : spaces.apply(s + " ", i - 1); | |
return spaces.apply("", 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
/** | |
* Exits the JVM using {@code Runtime.getRuntime().exit(status)} (which is equivalent to | |
* {@code System.exit(0)}). If something goes wrong while running the finalizers and shutdown | |
* hooks, or the timeout is reached, the JVM is forced to be terminated by calling | |
* {@code Runtime.getRuntime().halt(status)}. | |
* | |
* @param status the exit status, zero for OK, non-zero for error | |
* @param timeout The maximum delay in milliseconds before calling | |
* {@code Runtime.getRuntime().halt(status)}. | |
* |
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 final class Assertions { | |
/** | |
* This class is not intended to be instantiated. | |
*/ | |
private Assertions() { | |
throw new AssertionError(Assertions.class.getName() + " cannot be instantiated."); | |
} | |
public static RunnableAssert assertThat(Runnable test) { |
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
$ alias antlr=./antlr.sh | |
$ antlr Issue118 start | |
Please enter input to be parsed and press <Ctrl>-D when finished. | |
a 1 b | |
<Ctrl>-D | |
(start a 1 b) | |
$ echo "a 1 b" > test.txt | |
$ antlr Issue118 start test.txt |
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
/** / \____ _ ______ _____ / \____ ____ _____ | |
* / \__ \/ \ / \__ \ / __// \__ \ / \/ __ \ Javaslang | |
* _/ // _\ \ \/ / _\ \\_ \/ // _\ \ /\ \__/ / Copyright 2014 Daniel Dietrich | |
* /___/ \_____/\____/\_____/____/\___\_____/_/ \_/____/ Licensed under the Apache License, Version 2.0 | |
*/ | |
package javaslang.collection; | |
import java.util.Iterator; | |
import java.util.NoSuchElementException; | |
import java.util.function.Predicate; |
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.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Predicate; | |
/** | |
* The Monad interface. | |
* | |
* @param <M> The type of the monad, e.g. {@code class Foo<A> extends Monad<Foo<?>, A, Foo<A>>}. | |
* @param <A> Component type of {@code M}. | |
*/ |
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
/* | |
* Java Quest | |
* ========== | |
* | |
* Write a method in two different contexts (read: Types) | |
* which takes a function which returns an object of the current type. | |
* | |
* T1<A> { <B> T1<B> m(f: A -> T1<B>); } | |
* T2<A> { <B> T2<B> m(f: A -> T2<B>); } | |
* |
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 labs; | |
import java.lang.invoke.MethodHandles; | |
import java.lang.reflect.InvocationHandler; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Proxy; | |
import java.util.Arrays; | |
import java.util.concurrent.ConcurrentHashMap; | |
import java.util.concurrent.ConcurrentMap; | |
import java.util.stream.Collectors; |
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; | |
import java.util.Calendar; | |
import java.util.Date; | |
import java.util.TimeZone; | |
/** | |
* A UTC date, consisting of a year, a month and a day component. Compared to {@linkplain java.util.Date} | |
* a StableDate is stable regarding {@linkplain java.lang.Object#equals} and {@linkplain java.lang.Object#hashCode}. | |
*/ | |
public class StableDate implements Comparable<StableDate>, Serializable { |
OlderNewer