Notice
Recent Posts
Recent Comments
Link
목록형프로그래밍 (1)
SeouliteLab
[Java/자바] 다수의 Consumer 연산을 andThen()으로 처리하는 방법
Java의 Consumer 인터페이스에서 제공하는 andThen() 메서드는 두 개의 Consumer를 연속적으로 실행할 수 있게 합니다. 여러 Consumer 연산을 순차적으로 처리하는 예제를 살펴보겠습니다. 예제 1: 문자열을 대문자로 변환한 후 출력하기 Consumer toUpperCase = str -> System.out.println("UpperCase: " + str.toUpperCase()); Consumer printLength = str -> System.out.println("Length: " + str.length()); Consumer combinedConsumer = toUpperCase.andThen(printLength); combinedConsumer.accept("hell..
프로그래밍
2024. 3. 13. 08:16