Lecture 17 - Advanced Java Flashcards
1
Q
Advantages of Functional Programming
A
Easier to run things in parallel. Can be more concise and readable. Can make code more flexible and powerful. Can be easier to test.
2
Q
Creating a stream from a source
A
From individual values, from an array, from a collection, from a range, from the lines in a file or an infinite stream.
3
Q
Properties of Streams
A
Can define infinite stream, can execute them in parallel or in serial, streams can only be traversed once, stick to pure functions.
4
Q
Lambda Functions
A
These functions should avoid state and mutable data (Variables that change their values). They should always produce the same output for a given input.