Java 17 Recipes
Download 3.2 Mb. Pdf ko'rish
|
Java 17 Recipes
- Bu sahifa navigatsiya:
- 7-11. Summary
- CHAPTER 8 Input and Output
How It Works
By default, operations are executed in a serial stream. However, you can specify that the Java runtime splits the operations between multiple subtasks, thus taking advantage of multiple CPUs for performance. When operations are executed in this manner, they are executed in “parallel.” The Java runtime can partition streams into multiple substreams by invoking the parallelStream() intermediate operation. When this operation is invoked, aggregate operations can process the multiple substreams, and then the results are combined in the end. You can also execute a stream in parallel by invoking the operation BaseStream.parallel(). Naturally, parallel streams have higher overhead compared to serial streams, so they are used if there is a performance problem to be addressed. Chapter 7 Data SourCeS anD ColleCtionS 291 7-11. Summary This chapter looked at various data structures and how to work with them. First, you took a look at Enums and learned how to utilize them effectively. Next, we covered the basics of Arrays and ArrayList and learned how to iterate elements within these structures. The chapter also covered Java generics, which allow you to decouple object types from container types, providing more type-safe and efficient code. Lastly, this chapter covered the Streams API, one of the most important updates introduced in Java 8 for working with collections. Chapter 7 Data SourCeS anD ColleCtionS 293 © Josh Juneau, Luciano Manelli 2022 J. Juneau and L. Manelli, Java 17 Recipes, https://doi.org/10.1007/978-1-4842-7963-2_8 CHAPTER 8 Input and Output The file and network I/O have evolved over the years into a much better framework for handling files, network scalability, and ease of use. Java can monitor folders, access OS- dependent methods, and create scalable asynchronous network sockets. This is in addition to the already robust library for handling input and output streams and serializing (and deserializing) object information. This chapter covers recipes that demonstrate different input and output processes. You learn about the serialization of files, sending files over the network, file manipulation, and much more. After reading the recipes in this chapter, you are armed to develop applications containing sophisticated input and output tasks. Download 3.2 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling