Skip to content

Instantly share code, notes, and snippets.

View yrashish's full-sized avatar
🏠
Working from home

Ashish Choudhary yrashish

🏠
Working from home
View GitHub Profile
List<Employee> employees = Arrays.asList(new Employee(1, "Ashish", 28, 10000)
, new Employee(2, "Ajay", 29, 1000)
, new Employee(3, "Abhishek", 29, 10000));
Map<Integer, String> map = employees
.stream()
.collect(Collectors.toMap(Employee::getId, Employee::getName));
Map<Long, List<Employee>> listMap = employees
.stream()
.collect(Collectors.groupingBy(Employee::getSalary));
var employees = Arrays.asList(new Employee(1, "Ashish", 28, 10000)
, new Employee(2, "Ajay", 29, 1000)
, new Employee(3, "Abhishek", 29, 10000));
var employeeMap = employees.stream()
.collect(Collectors.toMap(Employee::getId, Employee::getName));
var groupedMap = employees.stream()
.collect(Collectors.groupingBy(Employee::getSalary));
//Cannot infer type: 'var' on variable without initializer
var x;
//Cannot infer type: lambda expression requires an explicit target type
var f = () -> {};
//Cannot infer type: variable initializer is 'null'
var g = null;
//Array initializer is not allowed here
var k = {1, 2};
var str = new String("Hello");
var list = new ArrayList<String>();
var integerList = List.of(1,2,3,4);
for (var data :integerList) {
System.out.println(data);
}
for (var i = 1; i <= integerList.size(); i++) {
System.out.println(i);
}
var path = Paths.get("/src/main/resources/app.log");
docker pull hiashish/spring-boot-jib-image
Using default tag: latest
latest: Pulling from hiashish/spring-boot-jib-image
5749e56bea71: Already exists
a3e61620654b: Already exists
e708be98c58f: Already exists
71f0443d2e95: Already exists
febab311d432: Already exists
6508f436f385: Already exists
c5e22041fc97: Already exists
{
"endTime" : "2021-11-20T08:43:56.244106Z",
"duration" : "PT0.431023S",
"startupStep" : {
"name" : "spring.beans.instantiate",
"id" : 54,
"tags" : [ {
"key" : "beanName",
"value" : "employeeRepository"
} ],
import io.r2dbc.spi.ConnectionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.r2dbc.connection.init.ConnectionFactoryInitializer;