☕

Java: Streams & Lambda

36 cards · 🇺🇸 English

Functional-style operations with Java Streams and lambda expressions.

Study all 36 cards for free

Flashcards, quizzes, pixel-art games and a daily review that remembers for you.

Study this deck free

Try the first 10 cards

1 / 10
Question

WORA in Java

Knew itLearning

Tap the card for the answer · swipe right if you knew it, left if not

Already have an account? Sign in

Cards

  1. 1WORA in Java
    Write Once, Run Anywhere - compiled Java code can run on all platforms that support Java without recompiling
  2. 2Lambda expression in Java
    An anonymous function that can be passed as an argument or assigned to a variable, introduced in Java 8 for functional programming
  3. 3Stream API in Java
    A functional programming feature for processing sequences of elements, supporting operations like filter, map, and reduce
  4. 4Functional interface
    An interface with exactly one abstract method that can be implemented using a lambda expression
  5. 5Syntax of a lambda expression
    (parameters) -> expression or (parameters) -> { statements; }
  6. 6Method reference in Java
    A shorthand notation for calling a method, written as ClassName::methodName, that can replace a lambda expression
  7. 7Filter operation in Stream API
    An intermediate operation that returns a stream with elements matching a predicate
  8. 8Map operation in Stream API
    An intermediate operation that transforms each element in the stream using a function
  9. 9Reduce operation
    A terminal operation that combines stream elements into a single result using an accumulator function
  10. 10intermediate vs terminal operations
    Intermediate operations are lazy and return a stream; terminal operations trigger computation and return a result
  11. 11ForEach in Stream API
    A terminal operation that performs an action for each element in the stream
  12. 12Collect in Stream API
    A terminal operation that accumulates stream elements into a collection or other result container
  13. 13Parallel streams
    Streams that process elements in parallel using multiple threads for improved performance on multi-core systems
  14. 14Create a parallel stream
    Call .parallelStream() on a collection or .parallel() on an existing stream
  15. 15FindFirst operation
    A terminal operation that returns an Optional containing the first element of the stream
  16. 16AnyMatch operation
    A terminal operation that returns true if any element in the stream matches the predicate
  17. 17Optional in Java
    A container object that may or may not contain a non-null value, used to avoid NullPointerException
  18. 18FlatMap in Stream API
    An intermediate operation that flattens nested streams, transforming each element into a stream and concatenating them
  19. 19Distinct in Stream API
    An intermediate operation that returns a stream with duplicate elements removed
  20. 20Sorted in Stream API
    An intermediate operation that returns a stream with elements sorted according to natural order or a comparator
  21. 21Limit in Stream API
    An intermediate operation that truncates the stream to contain no more than a specified number of elements
  22. 22Skip in Stream API
    An intermediate operation that discards the first n elements of the stream
  23. 23Count in Stream API
    A terminal operation that returns the number of elements in the stream
  24. 24Predicate functional interface
    A functional interface representing a boolean-valued function of one argument, used for filtering
  25. 25Function functional interface
    A functional interface representing a function that accepts one argument and produces a result
  26. 26Consumer functional interface
    A functional interface representing an operation that accepts a single input and returns no result
  27. 27Supplier functional interface
    A functional interface representing a supplier of results, taking no arguments and producing a value
  28. 28Lazy evaluation in streams
    Intermediate operations are not executed until a terminal operation is invoked, optimizing performance
  29. 29Java.util.stream package
    The package containing classes and interfaces for functional-style operations on streams of elements
  30. 30Benefit of using streams over loops
    More concise and readable code, automatic parallelization, and better separation of concerns

And 6 more cards. Study the whole deck free

Articles about this deck

More Programming decks

See all
Study all 36 cards free