Lazy

컬렉션 연산시 지연(lazy), 즉시(eagerly) 계산의 차이는 무엇인가? 즉시(eagerly)연산은 커렉션함수를 연쇄할 때마다 계산 중간 결과를 새로운 컬렉션에 임시로 담는다. 시퀀스(sequence)를 사용하면 중간 임시 컬렉션을 사용하지 않고 컬렉션 연산을 연쇄한다. people .filter { it.lastName != null } .filter { it. age!= null } .find { it.age == 31 } people.asSequence() // 컬렉션을 시퀀스로 변환 .filter { it.lastName != null } // Intermediate operation .filter { it. age!= null } // Intermediate operation .find {..
깡냉쓰
'Lazy' 태그의 글 목록