Skip to content

Instantly share code, notes, and snippets.

View zlaval's full-sized avatar

Zalan Toth zlaval

View GitHub Profile
provider "aws" {
region = var.region
default_tags {
tags = {
Environment = "Development"
}
}
}
variable "region" {
description = "AWS Region"
default = "eu-central-1"
type = string
}
variable "namespace" {
description = "Project namespace"
type = string
}
namespace = "dev"
region = "eu-central-1"
project_name = "terrenv"
ssh_key = "my_public_ssh_key"
BinaryOperator<Integer> binaryOperator = (a, b) -> a * b;
binaryOperator.apply(3, 5);
Consumer<String> consumer = in -> System.out.println(in);
consumer.accept("Hello World");
void printWhenLT(int value, Predicate<Integer> testValue) {
if (testValue.test(value)) {
System.out.println(value);
}
}
Predicate<Integer> lt10 = value -> value < 10;
Predicate<Integer> lt20 = value -> value < 20;
printWhenLT(5, lt10);
Supplier<String> strSupplier = () -> "Hello world";
String str = strSupplier.get();
void effectivelyFinal() {
int count = 10;
Converter<Integer, String> converter = from -> String.valueOf(from * count);
System.out.println(converter.convert(10));
//count++;
}
Converter<String, Integer> fnConverter = (String from) -> Integer.valueOf(from);
System.out.println(fnConverter.convert("10"));
Converter<String, Integer> rfConverter = Integer::valueOf;
System.out.println(rfConverter.convert("10"));
@zlaval
zlaval / Converter.java
Last active June 28, 2022 13:38
Converter.java
Converter<String, Integer> converter = new Converter<String, Integer>() {
@Override
public Integer convert(String from) {
return Integer.valueOf(from);
}
};
System.out.println(converter.convert("10"));