diff --git a/data/part-10/1-handling-collections-as-streams.md b/data/part-10/1-handling-collections-as-streams.md index 076593d3e..f7b2d59a5 100644 --- a/data/part-10/1-handling-collections-as-streams.md +++ b/data/part-10/1-handling-collections-as-streams.md @@ -216,7 +216,7 @@ A brief summary of the stream methods we've encountered so far.
stream()
mapToInt(value -> another)
filter(value -> filter condition)
true
, the element is accepted into the stream. If the boolean evaluates to false, the value is not accepted into the stream. Something is done with the filtered values.
average()
getAsDouble()
that returns a value of type double
. Calling the method average()
works on streams that contain integers - they can be created with the mapToInt
method.
count()
long
-type value.
Streams are also very handy in handling files. The file is read in stream form using Java's ready-made Files class. The `lines` method in the files class allows you to create an input stream from a file, allowing you to process the rows one by one. The `lines` method gets a path as its parameter, which is created using the `get` method in the Paths class. The `get` method is provided a string describing the file path.
+Streams are also very handy in handling files. The file is read in stream form using Java's ready-made Files class. The lines
method in the files class allows you to create an input stream from a file, allowing you to process the rows one by one. The lines
method gets a path as its parameter, which is created using the get
method in the Paths class. The get
method is provided a string describing the file path.
The List interface defines the basic functionality related to lists. Because the ArrayList class implements the `List` interface, one can also use it through the `List` interface.
+The List interface defines the basic functionality related to lists. Because the ArrayList class implements the List
interface, one can also use it through the List
interface.
As we can see fom the Java API of List, there are many classes that implement the `List` interface. One list that is familiar to computer scientists is a linked list. A linked list can be used through the List interface exactly the same way as an object created from ArrayList.
+As we can see fom the Java API of List, there are many classes that implement the List
interface. One list that is familiar to computer scientists is a linked list. A linked list can be used through the List interface exactly the same way as an object created from ArrayList.