Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
110 views

In Java, replace for loop with condition with lambdas [closed]

I want to replace a for loop with a break/return condition inside with a lambda. I think I have a good replacement, but I want ...
Oscar Besga Panel's user avatar
2 votes
1 answer
318 views

FizzBuzz with Lambda Expressions in Java

I wanted to create a FizzBuzz in Java that is supposed to be open for extension. So the initial problem is the good old, if divisible by 3 print fizz, if divisible by 5 print buzz, if divisible by ...
Koray Tugay's user avatar
  • 1,557
1 vote
1 answer
322 views

Control class for an entity

For a Student object in the package entity, I have a control.studentpackage with classes ...
the duck wizard's user avatar
3 votes
1 answer
104 views

Numerical streams example

I am reading "Java 8 In Action" (by Raoul-Gabriel Urma, Mario Fusco and Alan Mycroft), section 5.6.3, pages 116 and 117. The code that is presented handles calculating so-called "Pythagorean Triples". ...
Steve T's user avatar
  • 183
11 votes
1 answer
8k views

Creating a pipeline operator in Java

I wrote the following as more of an experiment than anything else, but I thought it would be fun to share and maybe get some feedback! Motivation: I started looking at some functional languages and ...
flakes's user avatar
  • 1,935
4 votes
1 answer
5k views

Lambda to obtain a new merged object

The requirement is to iterate over a list of Foos, and when 2 Foos have the same id merge ...
arin's user avatar
  • 143
2 votes
1 answer
3k views

Routing Java objects using conditional consumers

As per a previous question here and answers I got, I used it to get a new implementation. I found that I have to make two implementations match once "to ignore other consumers after matching once" and ...
Bassem Reda Zohdy's user avatar
13 votes
2 answers
730 views

Printing removed items using lambdas and streams

I'm struggling to make my lambdas readable. I've seen various approaches. Below are three different examples that all do the same thing. Forgive the example: I suspect there are better actual ...
David Lavender's user avatar
18 votes
3 answers
27k views

Effective use of multiple streams

I am experimenting with streams and lambdas in Java 8. This is my first serious foray using functional programming concepts; I'd like a critique on this code. This code finds the Cartesian product of ...
MonkeyWithDarts's user avatar