Threads
Streams
Functional
Lambda Expression
Misc.
100

The life cycle of threads

100

T/F: Streams do not support aggregate operations.

False. They support aggregate operations like filter, map, limit, reduce, find, match, etc.

100

T/F: Java supports functional programming

True

100

Syntax for Lambda expressions

parameter -> expression body

100

Syntax for annotations

What is the "@" symbol followed by the annotation's name?

200

Keyword to synchronize a thread

What is the synchronized keyword?

200

Difference between stream() and parallelStream()

In the output of a stream(), the contents are in an ordered sequence. The output of a parallelStream() is unordered, and the sequence changes each time the program is run. 

200

What makes Fold different from Reduce?

Fold requires an initial value.

Integer sum = integers.reduce(Integer::sum); //REDUCE

Integer sum = integers.reduce(0, Integer::sum); //FOLD

200

T/F: Lambda expressions with multiple parameters require parentheses. 

True. Parentheses are  option if it only contains one parameter.

200

What package is LocalDateTime and ZonedDateTime imported from?

java.time

300

Two ways to create a thread

What is by extending the Thread class or implementing Runnable interface

300

Two ways to create a parallel stream

Using parallelStream() on a collection, or using the parallel() method on a stream. 

300

T/F: Filtering a collection changes the original collection.

False. Filtering makes a new collection and returns that.

300

T/F: Lambda expressions are treated as a function, so the compiler does not create a .class file

True

300

Difference between shallow clone and deep clone?

Shallow clone only copies the fields. Deep clone copies the fields and what they reference.

400

Difference between notify() and notifyAll() 

notify() releases one thread that is waiting. notifyAll() releases all threads that are waiting.

400

A stream is considered consumed when what type of operation is invoked?

Terminal operation. No other operation can be applied to the stream elements afterward. 

400

T/F: A logic can't be packed as a variable.

False

400

What are the three components of a lambda expression?

Argument list, arrow token, body

400

What interface do you implement to use clone()?

Cloneable interface

500

How do you prevent deadlock?

Synchronize threads 

500

What are the conditions for a concurrent reduction?

The stream is parallel. The stream is unordered or has characteristic of Collector.Characteristics.UNORDERED. The parameter of the collector has characteristic of Collector.Characteristics.CONCURRENT.

500

Difference between compose() and andThen()

compose() executes the caller last and parameter first.

andThen() executes the caller first and parameter last. 

500

True or False: Lambda expressions always require curly braces.

False. Curly braces aren't needed if the expression body only contains a single statement.

500

What does the peek() operation do?

Return a stream consisting of the elements of the stream and performs provided action of each element from the resulting stream. Used to support debugging.

M
e
n
u