Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| ||||
Core Java - Interview Questions and Answers for 'Parallel stream' - 3 question(s) found - Order By Newest | ||||
| ||||
Ans. Spliterator has better performance potential than iterators but only if the potential is used. Spliterator can iterate streams in parallel as well as in sequence whereas iterator can only iterate in sequence. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
| ||||
Ans. streams are used for sequential processing of data and parallel streams are used for parallel processing of data (only if the underlying processor is multicore). | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
| ||||
Ans. This can be done using a Spliterator. LinkedList list = Arrays.asList("names","numbs","birds","animals"); Spliterator split1 = list.Spliterator(); Spliterator split2 = split1.Spliterator(); Now, the LinkedList is split into split1 and split2. use split2 first then split1 to check the output. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||