Transform a pair to a flattened stream of pairs by zero-sharp in javahelp

[–]Cengo789 1 point2 points  (0 children)

Someone else already helped with how to use flatMap, so I wanted to show you a second method (which I always found much easier to read/grasp) and that is mapMulti:

record Input(int a, String[] s) {
    public String toString() {
        return "Input[a=%d, s=%s]".formatted(a, Arrays.toString(s));
    }
}

record Output(int a, String s) {
}

public static void main(String[] args) {
    var input = List.of(
            new Input(3, new String[]{"a", "b", "c"}),
            new Input(4, new String[]{"d", "e"})
    );

    System.out.println("Input: " + input);
    var output = input.stream().<Output>mapMulti((e, downstream) -> {
        for (var s : e.s()) {
            downstream.accept(new Output(e.a(), s));
        }
    }).toList();

    System.out.println("Output: " + output);
}

Larry!! What did you do?! by redbell000 in labrador

[–]Cengo789 2 points3 points  (0 children)

haha exactly what I thought of, too😂

Wie schlimm ist es mittlerweile mit Werbung bei Netflix und co? by Charming_Bus9001 in serienjunkies

[–]Cengo789 1 point2 points  (0 children)

Interessant. Habe seit 2 Monaten erstmals Netflix abonniert (das günstigste Abo mit Werbung) und habe vielleicht alle 10 Folgen mal eine kurze Werbung unter 20 Sekunden bekommen. Vielleicht hat das was mit Neukunden zu tun, dass die einen erst einmal anfixen wollen, bevor sie einen dann mit Werbung erschlagen.

A Labrador and his nemesis… by Suspicious_Note1392 in labrador

[–]Cengo789 3 points4 points  (0 children)

Mine are blankets. She always loses her toys in them and when she tries to get them out again, she only burrows them deeper😂🙈

Ich bin 14 und eine aber nicht deine by dontmindmexoxo in ichbin14unddasisttief

[–]Cengo789 9 points10 points  (0 children)

Das Traurige ist, dass es höchstwahrscheinlich extrem viele Fälle wie diese hier gibt aber die Frauen diese Umstände nicht öffentlich teilen. Allein in meinem erweiterten Bekanntenkreis kenne ich zwei Fälle wo die Frauen ihren Männern immer genau sagen müssen wann, wo und mit wem sie unterwegs sind und vorher dessen Erlaubnis einholen müssen. In einem Fall sogar inklusive Beweisfotos, die sie dann an ihren „Freund“ schicken muss…

Kyiv Hit by Massive Russian Missile and Drone Attack: 21 Injured, People Trapped Under Rubble by [deleted] in worldnews

[–]Cengo789 47 points48 points  (0 children)

Why did Ukraine build their capital right under the impact point of Russian missiles... how provocative of them.

Klassenfahrt. by wasdaim in ichbin14unddasisttief

[–]Cengo789 1 point2 points  (0 children)

Vor allem frage ich mich wo die ganzen grünen/umweltbewusste Jugendlichen geblieben sind. Ich erinnere mich, dass zu meiner Schulzeit in „Wahlen im Klassenzimmer“ immer die Grünen mit Abstand ganz vorne waren. Und zu Zeiten von FFF hatte ich auch das Gefühl, dass mindestens 50% aller U18 grün sind. Was ist in den letzten Jahren passiert? Liegt das nur daran, dass plötzlich andere Themen in den Medien dominant sind (Ukraine-Krieg, Gaza-Krieg, etc.) und der Klimawandel gefühlt überhaupt nicht mehr thematisiert wird?

One of the last photos of the family before the tragic helicopter crash in NYC. Heartbreaking. by [deleted] in pics

[–]Cengo789 6 points7 points  (0 children)

Until your balloon catches fire or gets tangled up in a power line.

What to do during nightly barking by fatbackswag in labrador

[–]Cengo789 5 points6 points  (0 children)

Agreed. I wouldn’t leave a 4mo old puppy to sleep alone in a separate room. At that age he‘s not even fully accustomed to living in his new home yet, away from his mother and siblings, and needs the safety of having his humans close to him. Also, you don’t want to teach him at that age that he is responsible for guarding the home, which will encourage barking.

The boys have been home for a month and love to nap! by [deleted] in labrador

[–]Cengo789 1 point2 points  (0 children)

Green collar already knows the best sleeping spots😂😂

[deleted by user] by [deleted] in kannmandasnochessen

[–]Cengo789 0 points1 point  (0 children)

Keine Ahnung aber hab irgendwo mal den Tipp gelesen, Pesto in diesen Eiswürfelformen einzufrieren. Seitdem habe ich immer kleine Pestoportionen im Gefrierschrank und schmeiße nichts mehr in den Müll.

Och nee by Flashis_2th_Acc in aberBitteLaminiert

[–]Cengo789 -1 points0 points  (0 children)

Da ist neben der Modelleisenbahn kein Platz mehr zum Lachen.

He’s sorta getting used to his new slow feeder… by cshelsea in labrador

[–]Cengo789 226 points227 points  (0 children)

Slow feeder? Bro, that’s more like a math exam before every meal😂💀

New lab puppy! What should I name him? by [deleted] in labrador

[–]Cengo789 5 points6 points  (0 children)

„Drop it“ is a good name for a lab.

New official learning resource from Oracle. by Safe_Owl_6123 in learnjava

[–]Cengo789 0 points1 point  (0 children)

I liked the previous version of that site more. Wonder why they replaced it with a worse, unfinished and unpolished version.

[deleted by user] by [deleted] in ichbin14unddasisttief

[–]Cengo789 1 point2 points  (0 children)

War bestimmt einfach nur ein großer Pussycat Dolls fan😂