use of com.coderbd.day19.ch8.streamsFilter.ex2.Student in project java-certification by springapidev.
the class NowJava8FilterMap method main.
public static void main(String[] args) {
List<Student> students = Arrays.asList(new Student("Munna", 30), new Student("Emon", 20), new Student("Rashidul", 30));
String name = students.stream().filter(x -> "Munna".equals(x.getName())).map(// convert stream to String
Student::getName).findAny().orElse("");
System.out.println("name : " + name);
int age = students.stream().filter(x -> "Munna".equals(x.getName())).map(// convert stream to String
Student::getAge).findAny().orElse(0);
System.out.println("age : " + age);
List<String> collect = students.stream().map(Student::getName).collect(Collectors.toList());
collect.forEach(System.out::println);
List<Integer> collects = students.stream().map(Student::getAge).collect(Collectors.toList());
collects.forEach(System.out::println);
out.println("hi..........");
}
use of com.coderbd.day19.ch8.streamsFilter.ex2.Student in project kripton by xcesco.
the class TestSchemaRuntime method testRun.
@Test
public void testRun() {
BindSchoolDataSource.build(DataSourceOptions.builder().databaseLifecycleHandler(new DatabaseLifecycleHandler() {
@Override
public void onUpdate(SQLiteDatabase db, int oldVersion, int newVersion, boolean upgrade) {
// TODO Auto-generated method stub
}
@Override
public void onCreate(SQLiteDatabase database) {
// TODO Auto-generated method stub
}
@Override
public void onConfigure(SQLiteDatabase database) {
// TODO Auto-generated method stub
}
}).build());
try (BindSchoolDataSource dataSource = BindSchoolDataSource.open();
DaoProfessorImpl dao = dataSource.getDaoProfessor()) {
// dataSource.execute(transaction);
for (int i = 0; i < 10; i++) {
Professor professor = new Professor();
professor.name = String.format("professor%03d", i);
professor.surname = "surname" + i;
professor.birthDate = new Date();
dao.insert(professor);
}
}
try (BindSchoolDataSource dataSource = BindSchoolDataSource.open();
DaoStudentImpl dao = dataSource.getDaoStudent()) {
// dataSource.execute(transaction);
for (int i = 0; i < 100; i++) {
Student student = new Student();
student.name = String.format("professor%03d", i);
student.location = String.format("location%03d", i);
dao.insert(student);
}
}
}
Aggregations