Skip to content

Instantly share code, notes, and snippets.

View xjj59307's full-sized avatar

otakugeek xjj59307

View GitHub Profile
@xjj59307
xjj59307 / PriorityQueue.java
Created April 27, 2019 07:59
659. Split Array into Consecutive Subsequences
Map<Integer, PriorityQueue<Integer>> valToSize = new HashMap<>();
private PriorityQueue<Integer> getOrPut(int num) {
PriorityQueue<Integer> sizeSet = valToSize.get(num);
if (sizeSet == null) valToSize.put(num, new PriorityQueue<>());
return valToSize.get(num);
}
public boolean isPossible(int[] nums) {
for (int num : nums) {
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.Test;
public class ThrowableLambdaTest {
@Test(expected = ClassNotFoundException.class)
public void testThrowableConsumer() throws ClassNotFoundException {
Stream.of("foo.bar").forEach(
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
// @see <a href="https://stackoverflow.com/questions/27644361/how-can-i-throw-checked-exceptions-from-inside-java-8-streams">how-can-i-throw-checked-exceptions-from-inside-java-8-streams</a>
public final class ThrowableLambda {
private ThrowableLambda() {}
@FunctionalInterface
@xjj59307
xjj59307 / soap-curl-shell
Created November 20, 2015 03:00 — forked from gustavohenrique/soap-curl-shell
SOAP request using curl
# request.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="http://sensedia.com/repository/wstoolkit">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1">
<wsse:Username>system</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">manager</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">DWk64SMfJ6RxHAKgPRGtPA==</wsse:Nonce>
<wsu:Created>2013-04-17T18:36:54.013Z</wsu:Created>
</wsse:UsernameToken>