Skip to content

Java Streams - It can help you write more concise, readable and efficient code

Notifications You must be signed in to change notification settings

MonikaSturman/JavaStreams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Java Streams provide a functional approach to processing collections of objects. They enable concise and expressive code for operations like filtering, mapping, sorting, and more. This repository demonstrates several common tasks solved using Java Streams.

Examples

  1. Sum of Even Numbers Calculate the sum of all even numbers in a list of integers.

  2. Count Strings by Length Find and print the count of strings with a length greater than 5.

  3. Square of Elements Implement a function to return a new list containing the square of each element in a list of integers.

  4. Maximum Element Find the maximum element in a list of integers.

  5. Concatenation of Strings Concatenate all strings in a list into a single string.

  6. Uppercase and Sort Strings Convert each string to uppercase and then sort them alphabetically.

  7. Average of Doubles Calculate the average of all numbers in a list of doubles.

  8. Unique Words Create a new list containing only unique words by removing duplicates.

  9. Check Condition for All Elements Check if all elements in a list satisfy a given condition.

  10. Check Element Existence Check if a list contains a specific element.

  11. Longest String Find the longest string in a list.

  12. Remove Null Values Remove null values from a list.

  13. Second-Smallest Element Find the second-smallest element in a list.

Contributing

Contributions are welcome! If you have any improvements or new examples to add, feel free to submit a pull request.

About

Java Streams - It can help you write more concise, readable and efficient code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages