Skip to content

Instantly share code, notes, and snippets.

View rokon12's full-sized avatar
🎯
Focusing

A N M Bazlur Rahman rokon12

🎯
Focusing
View GitHub Profile

Project Instructions

Architecture

  • Layered: Controller β†’ Service β†’ Repository
  • DTOs are Java records. Never expose JPA entities in API responses.
  • Constructor injection only. No field injection.

Code Style

  • No catch-all catch (Exception e). Handle specific exceptions.
  • Validate inputs at the controller layer using Jakarta Validation.
@rokon12
rokon12 / README.md
Created June 29, 2025 04:39
Code snippet from The Coding CafΓ© - Complete Code Reference

Complete Code Reference

This gist contains all code snippets from the article.

Files:

  • snippet-3.java
  • snippet-7.java
  • snippet-10.java
  • snippet-2.java
@rokon12
rokon12 / README.md
Created June 29, 2025 04:31
Code snippet from The Coding CafΓ© - Complete Code Reference

Complete Code Reference

This gist contains all code snippets from the article.

Files:

  • snippet-3.java
  • snippet-7.java
  • snippet-10.java
  • snippet-2.java
@rokon12
rokon12 / README.md
Created June 29, 2025 04:30
Code snippet from The Coding CafΓ© - Complete Code Reference

Complete Code Reference

This gist contains all code snippets from the article.

Files:

  • snippet-3.java
  • snippet-7.java
  • snippet-10.java
  • snippet-2.java
@rokon12
rokon12 / README.md
Created June 29, 2025 04:23
Code snippet from The Coding CafΓ© - Complete Code Reference

Complete Code Reference

This gist contains all code snippets from the article.

Files:

  • snippet-3.java
  • snippet-7.java
  • snippet-10.java
  • snippet-2.java
@rokon12
rokon12 / README.md
Created June 29, 2025 04:22
Code snippet from The Coding CafΓ© - Complete Code Reference

Complete Code Reference

This gist contains all code snippets from the article.

Files:

  • snippet-3.java
  • snippet-7.java
  • snippet-10.java
  • snippet-2.java
@rokon12
rokon12 / README.md
Created June 29, 2025 04:16
Code snippet from The Coding CafΓ© - Complete Code Reference

Complete Code Reference

This gist contains all code snippets from the article.

Files:

  • snippet-3.java
  • snippet-7.java
  • snippet-10.java
  • snippet-2.java
@rokon12
rokon12 / snippet-2.java
Created June 29, 2025 02:29
Code snippet from The Coding CafΓ© - snippet-2.java
List<Integer> runningMax = values.stream()
.gather(Gatherers.scan(
() -> Integer.MIN_VALUE, // 1️⃣ Start with smallest possible value
Integer::max // 2️⃣ Keep the maximum at each step
))
.toList();
System.out.println("Running maximum: " + runningMax);
// Output: [-2147483648, 1, 5, 5, 8, 8, 9, 9, 9, 9]
// ↑ initial ↑ 5>1 ↑ 8>5 ↑ 9>8
List<Integer> runningMax = values.stream()
.gather(Gatherers.scan(
() -> Integer.MIN_VALUE,
Integer::max
))
.toList();
System.out.println("Running maximum: " + runningMax);
// Output: [-2147483648, 1, 5, 5, 8, 8, 9, 9, 9, 9]
// ↑ initial ↑ 5>1 ↑ 8>5 ↑ 9>8
@rokon12
rokon12 / snippet-2.java
Last active June 29, 2025 02:23
Code snippet from The Coding CafΓ© - snippet-2.java
List<Integer> runningMax = values.stream()
.gather(Gatherers.scan(
() -> Integer.MIN_VALUE,
Integer::max
))
.toList();
System.out.println("Running maximum: " + runningMax);
// Output: [-2147483648, 1, 5, 5, 8, 8, 9, 9, 9, 9]
// ↑ initial ↑ 5>1 ↑ 8>5 ↑ 9>8