Skip to content

This project is a Java application that explores the functionalities of the Java Stream API

Notifications You must be signed in to change notification settings

NathanaelSantos/Java-Streams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Java Stream API Exploration

This project is a simple Java application that explores the functionalities of the Java Stream API.

Features

  1. Filtering and Collecting: The application demonstrates how to filter a list of integers to get only the even numbers, both with a traditional for loop and with the Stream API.

  2. Finding Elements: It shows how to find a specific element in a list of strings using the Stream API.

  3. Mapping and Collecting: The application creates a list of Fruit objects, each with a name, category, and price. It then uses the Stream API to create a new list containing only the prices of the fruits.

  4. Mapping and Discounting: It demonstrates how to apply a function to each element in a stream to create a new stream. In this case, it applies a 20% discount to the price of each fruit.

  5. Skipping and Limiting: The application shows how to use the skip and limit operations to manipulate the size of the stream.

  6. Sorting: Finally, it sorts the list of fruits in order from highest to lowest price.

Running the Code

To run the code, simply execute the Main class. The results of each operation will be printed to the console.

Conclusion

This project provides a clear and concise introduction to the Java Stream API, demonstrating its power and flexibility for manipulating collections of data. It serves as a great starting point for anyone looking to understand and utilize this feature of Java.

About

This project is a Java application that explores the functionalities of the Java Stream API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages