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
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) { |
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.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( |
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.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 |
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
# 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> |