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
# The value of ssl_verify_callback is assigned to Net::HTTP#verify_callback | |
response = RestClient::Resource.new( | |
'https://localhost?q=Foo', | |
:ssl_client_cert => OpenSSL::X509::Certificate.new(File.read(ssl_client_cert)), # Part of the Client Certificate Validation | |
:ssl_client_key => OpenSSL::PKey::RSA.new(File.read(ssl_client_key), key_pass), # Part of the Client Certificate Validation | |
:ssl_ca_file => ssl_ca_file, # Part of the Client Certificate Validation | |
:verify_ssl => OpenSSL::SSL::VERIFY_PEER, # Part of the Client Certificate Validation | |
:ssl_verify_callback => lambda(&method(:ssl_verify_callback)) # Part of the Client Certificate Validation | |
).get |
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 main; | |
public class DeoptimizationExample { | |
public static void main(String[] args) { | |
for (int i = 0; i < 50000; i++) { | |
MyInterface myInterface; | |
if (i < 45000) { | |
// The first 45.000 executions will enter here | |
myInterface = new MyInterfaceImpl(); | |
} else { |
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
addPrometheusServiceDiscoveryService 'my_image_name' 8080 'my_container_prefix_' myservice | |
# | |
# Function responsible to add specific instances to a prometheus service discovery file | |
# | |
function addPrometheusServiceDiscoveryService { | |
IMAGE_NAME=$1 | |
NUM_INSTANCES=$(docker ps | grep -c "$IMAGE_NAME") | |
PORT=$2 | |
CONTAINER_NAME=$3 |
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
/** | |
* In this operation we are doing 0 conversions, since we are working only with primitive type | |
*/ | |
private static void operationWithPrimitiveTypeFunctionInterface(){ | |
long startTime = System.currentTimeMillis(); | |
int[] array = initValues(); | |
IntPredicate predicate = i -> i % 2 == 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
default <V> Function<V, R> compose(Function<? super V, ? extends T> before) { | |
Objects.requireNonNull(before); | |
return (V v) -> apply(before.apply(v)); | |
} |
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
default <V> Function<T, V> andThen(Function<? super R, ? extends V> after) { | |
Objects.requireNonNull(after); | |
return (T t) -> after.apply(apply(t)); | |
} |
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
@FunctionalInterface | |
interface ParentInterface{ | |
void parentAbstractMethod(); | |
} | |
@FunctionalInterface | |
interface ChildInterface extends ParentInterface{ | |
void parentAbstractMethod(); | |
default void defaultChildMethod1(){ |
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
@FunctionalInterface | |
public interface FunctionalI { | |
void abstractMethod(); | |
default String defaultMethod() { | |
return "defaultMethod"; | |
} | |
static String staticMethod() { | |
return "staticMethod"; |
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 ConcatStringInterface { | |
String concat(String param1, String param2); | |
} | |
class ConcatStringImpl implements ConcatStringInterface { | |
public String concat(String param1, String param2) { | |
return param1 + param2; | |
} | |
} |
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 StaticMethods { | |
public static void main(String[] args) { | |
InterfaceWithStaticMethod impl1 = (text) -> System.out.println("Custom Message " + text); | |
impl1.printWithCustomMessage("Text"); | |
InterfaceWithStaticMethod.print("Text"); | |
} | |
} | |
interface InterfaceWithStaticMethod { | |
void printWithCustomMessage(String text); |
NewerOlder