Spring/JAVA 22

[Java8 Lambda] Closures in Lambda Expressions

🤹‍♂️Java Brains 강의🤹‍♂️ https://www.youtube.com/playlist?list=PLqq-6Pq4lTTa9YGfyhyW2CqdtW9RtY-I3 ✔️ Closure : 내부에서 외부 함수의 지역 변수 호출하기 · Code public class Main { public static void main(String[] args) { int a = 10; int b = 20; doProcess(a, i -> System.out.println(i + b)); } private static void doProcess(int i, Process p) { p.process(i); } } interface Process { void process(int i); } ➡️ main 함수에서 do..

Spring/JAVA 2023.10.16

[Java8 Lambda] Exception Handling in Lambdas (try - catch)

🤹‍♂️Java Brains 강의🤹‍♂️ https://www.youtube.com/playlist?list=PLqq-6Pq4lTTa9YGfyhyW2CqdtW9RtY-I3 💡 someNumbers 배열 원소들을 key 값으로 나눈 나머지 출력하기 💡 · key 값이 2일 때 출력 (정상) · key 값이 0일 때 출력 (예외 상황) · Code import java.util.function.BiConsumer; public class Main { public static void main(String[] args) { int[] someNumbers = {1,2,3,4}; int key = 2; process(someNumbers, key, wrapperLambda((v, k) -> System.out...

Spring/JAVA 2023.10.13

[Java8 Lambda] Using Functional Interfaces (Predicate, Consumer)

🤹‍♂️Java Brains 강의🤹‍♂️ https://www.youtube.com/playlist?list=PLqq-6Pq4lTTa9YGfyhyW2CqdtW9RtY-I3 🐣 Missions 🐣 ☝️ Sort list by last name ✌️ Create a method that prints all elements in the list 👌 Create a method that prints all people that have last name beginning with C 🐤 Solution 🐤 · Interface public class Person { private String firstName; private String lastName; private int age; public Person(..

Spring/JAVA 2023.10.12

[Java8 Lambda] Lambda Expressions

🤹‍♂️Java Brains 강의🤹‍♂️ https://www.youtube.com/playlist?list=PLqq-6Pq4lTTa9YGfyhyW2CqdtW9RtY-I3 ✨ Code in OOP ☑️ Object Oriented Programming (OOP) 에 문제가 있어서 Java8 Lambda 가 나온 것 (진짜?) · Everything is an object · All code blocks are 'associated' with classes and objects ✨ Why Lambdas? · Enables functional programming · Readable and concise code · Easier to use APIs and libraries · Enable support f..

Spring/JAVA 2023.10.10

Java 제어문3 - 반복문 (+ 배열)

🐣생활코딩 강의🐣 JAVA 제어문 https://www.youtube.com/playlist?list=PLuHgQVnccGMCoEXnWV8-UF1mBxK5ftmxH Looping Statement 🥚 반복문 기본 구조 · while · for public class Main { public static void main(String[] args) { System.out.println(1); int i = 0; System.out.println("=== while ==="); while(i < 3) { System.out.println(2); System.out.println(3); i++; } System.out.println("=== for ==="); for(int j = 0; j < 3; j++) ..

Spring/JAVA 2023.10.06
728x90