Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Java Stream

QuestionAnswer
Stream takes Collection, Arrays, or I/O resources as input source true
Which package should be imported to use Stream API in Java 8? java.util.stream includes all the classes and interfaces used for functional-type operations
<> terminal operation is used to convert the source stream into collections by using intermediate operations Collect() Result stream may be of the list, set, map, etc
Which are intermediate operations in Stream API? filter map sorted
How many operations are performed in stream API to get the result? two Intermediate( will process the stream to get the result and terminal operations (it is the end of the stream to return the result)
< > will work on the streams and transform the single input value into multiple outputs by flattening it flatMap()
choose all that apply, forEach() is used when we need to iterate the elements in the stream is a terminal operation that returns void can be called directly collections or stream
main() { Stream.iterate(1, element->element+1) .filter(element->element%2==0) .limit(4) forEach(System.out::println); } 2,4,6,8 iterate() is used to iterate through the elements in the stream, filter() used to apply the condition on the stream and forEach() is used to return the result from the stream after iteration
Stream<String> s = Stream.of("apple", "orange", "apple", "banana", "banana"); s.distinct().forEach(System.out::print); returns appleorangebanana distinct() will return a stream from the source stream removing the duplicate elements
< > is a collection of objects which can be processed to get the desired result Stream API
< > terminal operations in stream API is used to return the result of the stream in a finite numbers count() ex. Which returns the number of employees working in a particular department
Which are ways to create a stream in Java8? using Stream.of() method using stream() & parallelStream() methods using Arrays.stream()
Stream<String> s = Stream.of("java", "SQL", "python", "JDBC"); s.filter(x->x.startsWith("S")).forEach(System.out::print); returns SQL Here we are using the filter to return the result of the element starting with "S"
Can we add or delete elements from streams? false we can only perform the operations on the stream and streams does not store the data as well
We need to import java.util.stream even after importing java.util.* in the code to use stream API True Stream class resides in the sub package java.util.stream, so it will not be included in java.util.*
Will the value of elements in the stream change when you process it? false Because stream API processes the elements as per pipelined operations without changing the values
< > can be used when we need to return the stream of elements in sorted order like sorting arrays sorted()
Which is a terminal operations from the following in Stream API forEach
Marshalling is… The process of sending data to a destination the process of converting an object instance into a data format that describes it
Reflection Allows Runtime modification of objects
Which of the following is an example of a marker interface? Serializable
Lambda is used to implement a functional Interface( an interface with a single abstract method) true
Marker interfaces are used to pass the information to JVM that a certain object of a class can implement methods like Serializable, Cloneable etc. true
1. Local class 2. Anonymous class 3. Lambda Expression 4. Nested class 4-a. Used to group classes that are reliable with each other, to increase encapsulation and to maintain cohesive, concise and readable code 1-d. Used to create more than one instance of a class, and to add new fields and methods to the class 2-c. Used when you need to use a local class only once 3-b. Used to create a simple instance of a functional interface
Created by: wahoo99
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards