Jj Roberts

Bartender
+ Follow
since Oct 25, 2019
Jj likes ...
Firefox Browser MySQL Database Java Ubuntu
Forum Moderator
Jj Roberts currently moderates these forums:
I dabbled in writing C code for micro controllers for a bit. Around June 2019 I was introduced to Java. I loved it from the start. I am now an Oracle Certified Java SE 11 Professional.
Cows and Likes
Cows
Total received
42
In last 30 days
0
Total given
10
Likes
Total received
117
Received in last 30 days
1
Total given
92
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt Green check

Recent posts by Jj Roberts

You mean like this?
(I have never been sure how to indent these properly)
Hi there and welcome!

If you go into one of the topic forums you will find a "New Topic" button on the top right
1 month ago
So at this point you have a stream of one or more PickOrderLine objects which matched your filter. Now you want to get the product code of one of them, so that you can use that product code to get the right Product from your list, right? If you have a look in the Oracle's documentation for Stream you will find how to get items from a stream. In particular, have a look at the findXXX() methods. If you need to, do some research on things that come up.
1 month ago

Matthias Utrata wrote:Is that the correct way? I tried to add a return on the start, because there is a return statement in the if statement, though when I add the return at the start. The whole stream has red waves. Is there a way to use the return with the stream?

Your IDE will tell you what is wrong; try hovering over the red lines. At the end of your stream code you still have a Stream<PickOrderLine>, just minus the items that were rejected by your filter. You still need to get the PickOrderLine object you want from the stream, and then use it to get a Product object to return.
1 month ago
You will need to stream the list: What issues are you experiencing with your filter()? Can you show what you are trying, and why it didn't work?
1 month ago
So the idea is to stream your list of PickOrder objects, and then FlatMap the lists of PickOrderLine objects that they contain, to get a stream of PickOrderLine. After that, you can find what you need from that. Can you do that?
1 month ago
It looks like you have a list of lists and you are trying to iterate through every item of every list. You could do that by combining the lists to make a single list of all items, and then iterate over that. We can do something similar with the stream method FlatMap. The FlatMap methods takes multiple streams and merges them into one, which you can process.

A very contrived example:Assuming a Student class

Can you apply that to your case?

Edit: Thanks Ron for pointing out that I used == for testing String equality. equals() should always be used to compare String values.
1 month ago
Sorry it has taken me so long to get back to this.

I'm not sure what you are referring to by STS, but it looks like you are using Eclipse. Eclipse requires you to create a new project for each module. It is possible to create a nested project in Eclipse, where you would have a parent project containing all of your module projects, but I doubt you need that. IntelliJ and Netbeans do allow multi-module projects.
1 month ago
Hi, can you show us what your directory structure looks like?
For example:(While pictures aren't the easiest thing to work with a picture of your project in an IDE could also work)
1 month ago
On your question, I don't know if you can. Wildfly's release notes mention this especially

Wildfly 21 release notes wrote:Please note that WildFly runs on Java 11 and later in classpath mode.

1 month ago
Hi there! A note: we prefer it if you are Forthright About Cross Posting <-- That's a link. I see you posted this earlier on Stack Overflow
1 month ago
Welcome to the Ranch!

I formatted your code for you. Doesn't that make it much easier to see what is going on?
1 month ago
Thank you so much! This is one book I really wanted and I'm so thrilled to win it here

Thank you Daniel Zingaro for a great promotion! It was great to have you around, and would still have been if there were no books given away
1 month ago
I also enjoy solving challenges, though I am not up to hard challenges yet. I joined Advent of Code last year for the first time. The first ten days were fine, but after that my wheels started falling off. It was there that I particularly wished I knew more about algorithms .
2 months ago