Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- mongodb
- RecursionError: maximum recursion depth exceeded while calling a Python object
- KOSDAQ
- AESCipher
- creon login
- handleMethodsArgumentNotValid
- spec
- header
- request param
- Creon
- pyinstaller
- WebServer
- EC2
- Slack
- stock trading
- URI
- The Internet
- Rest
- Version Control
- Auto Login
- Stock
- Web Crawler
- mime type
- ExceptionHandler
- Instance
- Daishin Securities
- AWS
- automated system
- API
- python
Archives
- Today
- Total
Change the Better World
Stream in Java 본문
Stream is an iterator that allows you to refer to the storage elements of a collection one by one and process them in a lambda expression, which has been added since Java 8. It acts similar to an Iterator, but the difference is that the code can be made more concise by providing the element handling code in a lambda expression, and that parallelism is easy because it uses an internal iterator.
Iterator vs Stream
// Iterator
List<String> list = Arrays.asList("Kim", "Sin", "Park");
Iterator<String> iterator = list.iterator();
while (iterator.hasNext()) {
String name = iterator.next();
System.out.println(name);
}
// Stream
Stream<String> stream = list.stream();
stream.forEach(name -> System.out.println(name));
'Programming > Java' 카테고리의 다른 글
what is the var keyword in Java 10? (0) | 2022.09.26 |
---|---|
Difference between String, StringBuilder, and StringBuffer. (0) | 2021.11.21 |
JDK, JRE, and JVM (0) | 2021.11.21 |
Comments