@org.junit.Rule
public org.junit.rules.ExpectedException expectedException = org.junit.rules.ExpectedException.none();$CURSOR$
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
zstyle ':prezto:module:zaw' default-history-search 'yes' | |
zstyle ':filter-select:highlight' matched fg=green | |
zstyle ':filter-select' max-lines 3 | |
zstyle ':filter-select' case-insensitive yes # enable case-insensitive | |
zstyle ':filter-select' extended-search yes # see below |
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
/* | |
Modules are not required, although usage is encouraged. This allows existing code to work within Java 9. | |
Code defined outside of a module is put in an `unnamed module` | |
Unnamed is a special module that is able to read from *all* other modules, *but* only the exported code (see below) | |
All of this is automatic when your code compiles. It allows your existing code to continue working as expected. | |
This is an example `module descriptor`. | |
It should be placed directly under the `src` dir, e.g. for in Maven `src/main/java/` | |
Must be named `module-info.java`. | |
*/ |
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 class RandomString { | |
public static String randomString(int len) { | |
final StringBuilder buffer = new StringBuilder(len); | |
ThreadLocalRandom.current() | |
.ints(len, 'A', 'Z') | |
.mapToObj(Character::toChars) | |
.forEach(buffer::append); | |
return buffer.toString(); | |
} | |
} |
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 ImmutableListCollector { | |
public static <T> Collector<T, ImmutableList.Builder<T>, ImmutableList<T>> toImmutableList() { | |
return Collector.of( | |
ImmutableList::builder, | |
ImmutableList.Builder::add, | |
(left, right) -> { left.addAll(right.build()); return left; }, | |
ImmutableList.Builder::build); | |
} | |
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
IntStream.range(1, 100).mapToObj(num -> { | |
final StringBuilder sb = new StringBuilder(8); | |
if (num % 3 == 0) { | |
sb.append("Fizz"); | |
} | |
if (num % 5 == 0) { | |
sb.append("Buzz"); | |
} | |
if (sb.length() == 0) { | |
sb.append(num); |
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.stream.IntStream; | |
public class FizzBuzz { | |
public static void main(String[] args) { | |
IntStream.range(1, 100).mapToObj(num -> { | |
final StringBuilder sb = new StringBuilder(8); | |
if (num % 3 == 0) { | |
sb.append("Fizz"); | |
} | |
if (num % 5 == 0) { |
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 org.streum.configrity._ | |
val config = Configuration.load( | |
System.getProperty("appConfigPropertyFile")) | |
val accessToken = config[String]("accessToken") |
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 com.typesafe.config.ConfigFactory | |
val conf = ConfigFactory.load() | |
val accessToken = conf.getString("accessToken") | |
val accessTokenSecret = conf.getString("accessTokenSecret") |
NewerOlder