Asked  6 Months ago    Answers:  5   Viewed   41 times

If I have a List<List<Object>>, how can I turn that into a List<Object> that contains all the objects in the same iteration order by using the features of Java 8?



You can use flatMap to flatten the internal lists (after converting them to Streams) into a single Stream, and then collect the result into a list:

List<List<Object>> list = ...
List<Object> flat =
Tuesday, June 1, 2021
answered 6 Months ago

Much simpler and cleaner with list comprehension:

[y for x in originalList for y in doSomething(x)]
Thursday, July 29, 2021
answered 4 Months ago

I have the same platform (netbeans 8.0 and JDK 8), searching in other project (build in netbeans 7.4 and JDK 7) I found a little difference in the file, search it in <>/nbproject, look for the line:


and change the text to finally be the following:


thats all, I don't know if it's a bug in netbeans 8 or maybe it's something wrong in the way to make the project, but this fix work for me, more details in this blog entry (spanish version)

Monday, August 2, 2021
answered 4 Months ago

Create a ConfirmationController for the FXML. From the controller, expose a method which allows you to pass data (string) to set to the label.

public class ConfirmationController implements Initializable {

    private Label proceed;
    public void setTextToLabel (String text) {

Inside your method where you are loading the FXML, you can have :

FXMLLoader loader = new FXMLLoader(getClass().getResource("Confirmation.fxml"));
confirmation = loader.load();
ConfirmationController controller = (ConfirmationController)loader.getController();
controller.setTextToLabel("Your Text"); // Call the method we wrote before
Saturday, August 7, 2021
answered 4 Months ago

The easiest way to do it is to create a new object with your shape and text attribute, and override the equals method. So you could be able to retrieve the shape and the text inside the shape.

You can also manage a second arraylist with your text, with matching index, like the shape in 0 have the text attribute in your text list in 0, but i do not recommand it, because it is really easy to create new issues.

Thursday, September 2, 2021
Rahul Sharma
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :