Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Java Lambda Streams Project

This repository contains implementations of various tasks using Java's Stream API and Lambda expressions. The project demonstrates functional programming concepts through different data processing operations, including filtering, sorting, generating sequences, and merging streams.

Table of Contents

  1. Introduction
  2. Features
  3. Technologies Used
  4. Implemented Tasks

Introduction

This project showcases different functional programming techniques in Java using Streams and Lambda expressions including:

  • Filtering names with odd indices and formatting them.

  • Sorting names in descending order while converting them to uppercase.

  • Extracting and sorting numbers from an array of strings.

  • Generating a sequence of random numbers using a linear congruential generator.

  • Merging two streams by interleaving their elements.

Features

  • Efficient data processing using Java Streams.

  • Functional programming with lambda expressions.

  • Sorting and filtering collections.

  • Generating sequences with custom logic.

  • Merging and manipulating streams.

  • Using Optional class.

Technologies Used

  • Java

  • Java Streams API

  • Lambda Expressions

  • Optional class

  • Functional Programming Concepts

  • Collections Framework

Implemented Tasks

1. Odd Indexed Names Filtering

  • Purpose: Extract names at odd indices and format them.
  • Features:
    • Uses Streams to filter names at odd indices.
    • Formats the output as index. name.
    • Methods Used: IntStream.range, filter, mapToObj, collect.

2. Descending Names Sorter

  • Purpose: Convert names to uppercase and sort in descending order.
  • Features:
    • Utilizes Streams for case conversion and sorting.
    • Returns a sorted list in descending order.
    • Methods Used: map, sorted, collect.

3. Number Extraction and Sorting

  • Purpose: Extract numbers from string arrays, sort, and return as a formatted string.
  • Features:
    • Parses and converts numbers from strings.
    • Sorts numbers and returns them in comma-separated format.
    • Methods Used: flatMap, map, sorted, collect.

4. Linear Congruential Generator (LCG)

  • Purpose: Generate an infinite stream of pseudo-random numbers.
  • Features:
    • Implements a linear congruential generator using Streams.
    • Accepts parameters for seed (start value), a (multiplier), c (increment), and m (modulus).
    • Methods Used: Stream.iterate, map, limit.

5. Stream Zipper

  • Purpose: Merge two streams by alternating elements.
  • Features:
    • Iterates over both streams simultaneously.
    • Stops when one of the streams is exhausted.
    • Methods Used: Stream.iterate, flatMap, of, reduce, stream.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages