2023-java-study / book-study

북 스터디 기록 레포지토리
0 stars 0 forks source link

[Item 47] Iterator에서 Iterable로 형변환 #139

Open ssstopeun opened 1 year ago

ssstopeun commented 1 year ago

코드 47-2

for(ProcessHandle ph : (Iterable<ProcessHandle>) ProcessHandle.allProcesses()::iterator){

}
ssstopeun commented 1 year ago

https://www.geeksforgeeks.org/convert-iterator-to-iterable-in-java/

ssstopeun commented 1 year ago

Is Iterable a functional interface in Java?

No, Iterable is not a functional interface in Java. It is a built-in interface that represents a collection of elements that can be iterated over using a for-each loop or an iterator. However, it does not have a single abstract method, which is a requirement for functional interfaces.

ssstopeun commented 1 year ago

https://www.codingninjas.com/studio/library/iterable-interface-in-java

NuhGnod commented 1 year ago

Iterable 인터페이스는 추상메서드 1개 + 디폴트 메서드 2개의 조합인 사실 Functional Interface?