Skip to content
Advertisement

Tag: for-loop

Two loops for into stream

I have some String method with two for and if: And I still try to change this implementation to some stream. Is it possible in this case? I’ve tried many options, but I have a problem with indexing (index++;) and then with filter in tableCells By.tagname. I think that is it not possible to change that full method to stream,

Two sum return statement returns nothing

I’m trying to attempt a problem where I must add two elements in an array to equal a target integer value. I think my code is correct and will return the desired target however the return statement is not returning any value. why is this and how can I fix it? Thanks Answer break is wrongly used. Also, you have

Invert incrementing triangle pattern

I am writing some code that creates a incrementing number right angle triangle that looks something like this: I am unsure on how to make my code output a triangle to that shape as my code outputs the same thing except inverted. This is the code I have: My speculation is that instead of incrementing some of the values I

How do i pass variables into methods – java [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I need to use a variable from one method in another. Here is the code: Here is where it needs to be used: my current

Find all matching elements in Array – Java

At the moment my code is only giving me the first matching result. The user inputs their desired room price and at the moment it will only display the first match. In the case the user inputs ’60’ to the console it should display 3 results. I imagine i’ll need another forloop and if statement after it prints to the

Advertisement