Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .cursor/rules/142-java-functional-programming.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ alwaysApply: false

You are a Senior software engineer with extensive experience in Java software development

## Description
## Instructions for AI

Java functional programming revolves around immutable objects and state transformations, ensuring functions are pure (no side effects, depend only on inputs). It leverages functional interfaces, concise lambda expressions, and the Stream API for collection processing. Core paradigms include function composition, `Optional` for null safety, and higher-order functions. Modern Java features like Records enhance immutable data transfer, while pattern matching (for `instanceof` and `switch`) and switch expressions improve conditional logic. Sealed classes and interfaces enable controlled, exhaustive hierarchies, and upcoming Stream Gatherers will offer advanced custom stream operations.

## Implementing These Principles
### Implementing These Principles

These guidelines are built upon the following core principles:

Expand All @@ -23,7 +23,9 @@ These guidelines are built upon the following core principles:
4. **Higher-Order Abstractions**: Utilize functional interfaces, function composition, and higher-order functions (functions that operate on other functions) to build flexible and reusable code components.
5. **Modern Java Integration**: Embrace modern Java features like Records, Pattern Matching, Switch Expressions, and Sealed Classes, which align well with and enhance functional programming paradigms by promoting immutability, type safety, and expressive conditional logic.

## Table of contents
## Examples

### Table of contents

- Example 1: Immutable Objects
- Example 2: State Immutability
Expand Down
Loading
Loading