r/JavaProgramming • • 7h ago

Java streams are lazy: this pipeline over four strings prints only two lines

4 Upvotes

Here’s the console output of a small program:

filter apple
map apple

That’s all. Four strings went in, and only the first one was ever looked at. Here’s the code:

String result = Stream.of("apple", "banana", "cherry", "date")
    .filter(s -> { System.out.println("filter " + s); return s.length() > 4; })
    .map(s -> { System.out.println("map " + s); return s.toUpperCase(); })
    .findFirst()
    .orElse("none");

result is "APPLE".

Two things explain the output.

Intermediate operations don’t run on their own. filter and map only describe what should happen. Nothing executes until a terminal operation like findFirst, collect or forEach asks for elements. If you remove .findFirst().orElse("none") and leave the pipeline hanging, it prints nothing at all.

Elements flow through one at a time. Instead of running filter over all four strings, then map over the survivors, each element goes through the whole chain before the next one starts. apple passes the filter, gets mapped, and arrives at findFirst, which has what it needs, so the pipeline stops. banana, cherry and date are never touched.

That’s why peek and print statements inside a pipeline can look confusing: the order of the output isn’t “all the filters, then all the maps”.

One exception worth knowing: stateful operations like sorted() have to see every element before they can emit the first one, so they break the one-at-a-time flow. A pipeline with sorted() in the middle will process everything up to that point before anything continues.

A practical consequence is that side effects inside map or filter are hard to reason about, because whether and when they run depends on what’s downstream. I’d keep those lambdas free of side effects and use peek only for debugging.

If you’ve hit a bug that came down to laziness, I’d be interested in what it looked like. Mine tend to be the “I added a map and nothing happened” kind.


r/JavaProgramming • • 11h ago

Coding Bootcamps (i.e. Front-End Simplified)

5 Upvotes

I was recently laid off from Java Developer role of 5 years. Been weighing my options and found some bootcamps that are promising job opportunities upon the program completion. These programs include front-end simplified and algomap.io.

I have my reservations about these kind of bootcamps because I can never tell if they are scams or not. Also, it is a very significant financial investment.

Does anyone have any experience with these specific bootcamps or if there any others like them that have worked for anyone?

Also if you can provide any advice on alternatives to help me get back on my feet, then that would be greatly appreciated.


r/JavaProgramming • • 11h ago

Structuring business logic that keeps changing as a pipeline of toggleable steps (Java library, looking for feedback)

1 Upvotes

In the projects I work on, business requirements change a lot. A validation rule gets added for one customer, a check has to be switched off for a while, a new step slots in between two existing ones. Over time the service methods that implement these flows turn into long chains of ifs and flags, and every change means touching code that's already working.

To deal with this I started modelling each business operation as a pipeline of small, named steps that share a typed context. I've extracted the approach into a small library, and I'd like some outside opinions on the design before going further.

Pipeline<CreateProductContext> createProduct = Pipeline.<CreateProductContext>builder("create-product")
          .step("name-unique", new NameUniqueStep(repository))
          .step("date-range", new DateRangeStep())
          .step("save-product", new SaveProductStep(repository))
          .build();

Product product = createProduct.run(new CreateProductContext(request)).getSavedProduct();

How it works:

  • Steps run in order and share a context. The first step that throws stops the pipeline.
  • Each step can be disabled through configuration (in Spring Boot: pipeline.disabled-steps) without changing code. Steps that must never be skipped are declared with requiredStep(...), and the starter refuses to start if the configuration tries to disable one.
  • Listeners receive lifecycle events (pipeline/step started, completed, failed, skipped) for logging, metrics or auditing.
  • Business errors carry a stable code and a category. Unexpected exceptions are wrapped with the pipeline and step where they happened. The Spring Boot starter maps both to ProblemDetail responses.

    Some design choices I'm not fully sure about:

  • "Required" is a builder method, not an annotation on the step class. Step is a functional interface, so lambdas can't be annotated, and the same step can be required in one pipeline and optional in another.

  • Disabling by name, via configuration. It's convenient, but I wonder whether it pushes too much business logic into config files.

  • A shared mutable context instead of each step returning a new immutable value. It's simpler to write, but the data flow between steps is less explicit.

Core is Java 17 with no runtime dependencies. There's also a Spring Boot 4.1 starter. It's version 0.1.0 on Maven Central, and code be found on GitHub: https://github.com/DifferenTilt/pipeline

The feedback I'd find most useful:

  1. Is this a real problem for you, and how do you handle it today (plain service classes, chain of responsibility, rule engines, workflow engines)?
  2. Is there an existing library that already does this and I should have looked at?
  3. Does the API feel natural, or is something awkward or missing?
  4. Is toggling steps via configuration a good idea or a footgun?

Thanks for reading. Criticism is welcome.


r/JavaProgramming • • 15h ago

MCA Student Looking for Genuine Job/Internship Platforms for Java Developers in India

2 Upvotes

Hi everyone,

I'm currently pursuing my MCA and preparing for Java Backend Development roles. I've been applying for internships and fresher jobs through platforms like Naukri and Internshala, but I'm not getting many responses or useful email updates.

I'm looking for genuine platforms where freshers can find Java Developer internships and entry-level software development jobs.

I'd appreciate your suggestions on the following:

  1. Which job portals have actually helped you get interviews or internships as a fresher?
  2. Is LinkedIn really effective for finding Java internships, or are there better alternatives?
  3. Are there any reliable platforms for finding opportunities at startups?
  4. Is it better to apply directly through company career pages or use job portals?
  5. Which platforms would you recommend for someone with basic Java, SQL, JDBC, and Spring Boot knowledge who is still improving their coding and problem-solving skills?

I'm open to opportunities in Pune, other cities, and remote positions.

I'm not looking for paid placement services or platforms that promise guaranteed jobs. I want genuine opportunities where I can improve my skills, gain practical experience, and start my software development career.

Please share your personal experiences and recommend platforms that have actually worked for you.

Thanks in advance!


r/JavaProgramming • • 13h ago

What's the best FREE resource/playlist available to learn DSA in Java?

Thumbnail
1 Upvotes

r/JavaProgramming • • 1d ago

Building full-stack web apps using TeaVM (and why it’s great for working with AI coding agents too)

3 Upvotes

Hey r/java,

TeaVM was something that had been on my radar for a while, and I finally got around to giving it a proper spin recently. After playing around with it and seeing what I can build with it I wanted to share my thoughts and hopefully get a few more eyes on the project!

If you haven’t run into it before, TeaVM is an ahead-of-time compiler that turns Java bytecode into JavaScript or WebAssembly. It operates directly at the bytecode level, emits remarkably clean JS, and integrates with your existing Java tooling.

Why this workflow clicked for me:

  1. One language across the stack: Keeping everything in Java keeps context-switching to a minimum and lets you share domain models directly between backend and frontend.
  2. AI Agent Friendly: Having both frontend and backend written in strongly-typed, readable Java makes it remarkably easy for LLM coding agents to navigate, refactor, and reason about the full application without hitting cross-language friction.

To document what I learned, I put together a 3-part series walking through how to build interactive frontends with TeaVM:

Has anyone else here given TeaVM a try? Would love to hear how your experience compares to other JVM web approaches!


r/JavaProgramming • • 1d ago

Migrating Java Applications to AWS Serverless: A Practical Guide

Thumbnail
javarevisited.substack.com
3 Upvotes

r/JavaProgramming • • 1d ago

Onde e como posso estudar programação? (Jakarta Faces)

Thumbnail
1 Upvotes

I need help where and how study Jakarta Faces, PrimeFaces


r/JavaProgramming • • 1d ago

Javac and java version not compatible

5 Upvotes

According to my terminal javac only works until java 52.0 but my code is in java version 70.0(java 26)how do i fix


r/JavaProgramming • • 1d ago

I decided the owner of a book copy should NOT be the borrower entity — my reasoning, tell me if I'm wrong

0 Upvotes

I'm rebuilding a legacy Java CLI library app into a peer-to-peer library platform (Java 21 / Spring Boot), where members catalog their own collections and lend copies to each other.

When I added ownership, the fastest path was to reuse my existing Borrower entity as the owner. I didn't. I created a separate LibraryMember entity instead, because in this system they do different jobs:

  • A member owns copies and lends them (and can be an INDIVIDUAL or an ORGANIZATION)
  • A borrower is an external patron of a library/org — someone who borrows through a member, not a platform member themselves

Collapsing them would have saved me an entity this week and cost me a tangled model every week after.

Each copy also carries visibility: PRIVATE (default, owner only, can't be borrowed) or PUBLIC (discoverable + borrowable), and my discovery query only returns available PUBLIC copies.

Curious how others have modeled this: in a sharing/lending platform, where did you draw the line between "user of the platform" and "person the user lends to"?

(Code, if useful: github.com/Pekins1/LibraryManagementSystem)


r/JavaProgramming • • 1d ago

Making games like the old yahoo games (pool, poker etc even runescape too)

3 Upvotes

I program in C but I've been taking a liking to java games recently. I just wanted to ask, what is developing games on Java truly like? Is there a difference say between early 2000s to now? Stupid question I'm sure, but I've never really dabbled in Java


r/JavaProgramming • • 1d ago

Free Door VPN: my first Android app. A free VPN that pauses your internet when the connection drops (looking for testers)

Post image
1 Upvotes

r/JavaProgramming • • 2d ago

Feedback para mi proyecto de Springboot

Thumbnail
github.com
2 Upvotes

r/JavaProgramming • • 3d ago

Is ByteByteGo a Good Place to Learn System Design?

Thumbnail
medium.com
4 Upvotes

r/JavaProgramming • • 3d ago

Want help regarding some scenarios...

Thumbnail
1 Upvotes

r/JavaProgramming • • 3d ago

How can I start with java

12 Upvotes

Hey everyone.
I am a computer science student, and I must start coding with Java.

I tried Eclipse and netbeans but none were valid on my machine.
so if someone has an alternate IDE I will much appreciated.


r/JavaProgramming • • 3d ago

India/IST | Java + Spring Boot + Angular | Looking for a serious interview prep partner

9 Upvotes

I'm currently preparing for full-stack/backend interviews and looking for someone who is also actively preparing for a job switch.

We can study together on a call/Discord, discuss Java/Spring Boot/SQL/DSA, solve problems, ask each other interview questions and keep each other accountable.

I'm looking for someone serious about actually showing up regularly, not just sharing resources.

If you're preparing for Java/Spring Boot/full-stack interviews, DM me.


r/JavaProgramming • • 3d ago

Under the Hood: How Redis Delivers < 1ms Latency

Thumbnail
javarevisited.substack.com
3 Upvotes

r/JavaProgramming • • 3d ago

Java DSA book suggestion

1 Upvotes

I am doing dsa in Java , I don't want to make notes.. Any book recommendation for DSA in java , a complete book with notes problems and examples??


r/JavaProgramming • • 3d ago

ZED Editor Prediction with Zeta

Thumbnail
youtu.be
1 Upvotes

r/JavaProgramming • • 3d ago

I really want to learn OOP for Kotlin/Java in Android studio apps but nothing sticks

Thumbnail
1 Upvotes

r/JavaProgramming • • 3d ago

Das UI-Framework für Java & Spring

Thumbnail
youtube.com
2 Upvotes

r/JavaProgramming • • 3d ago

Killing Reflection at Build Time: Avro, Codename One and Java Code Generation (Foojay Podcast #103)

Thumbnail
youtube.com
1 Upvotes

r/JavaProgramming • • 4d ago

What I learned while building my first Spring Boot project

12 Upvotes

As a 2026 B.Tech IT graduate, I've been learning Java and Spring Boot and building a Job Portal project.

One thing I've realized is that learning concepts is different from actually implementing them in a project.

I'm currently working on improving my backend skills and understanding how real-world applications are built.

For Java developers, what's one thing you wish you had learned earlier when starting your career?


r/JavaProgramming • • 4d ago

Will i be a good java developer if i don't learn Linked List and double linked list?

5 Upvotes

What the title says. I'm early in my degree and i cannot for the love of god learn how to apply these concepts to java. I'm also an intern so i don't have a lot of time to study. If i miss out on this particular subject will it make me a bad developer?