Blackout Roulette Blackout Roulette - 1 year ago 108
Java Question

Java 8 Stream: 1 Object to 2 Objects

Is it possible to do something like this with the Stream API?

LinkedList<Point> l = new LinkedList<>();
for(Edge e : EDGES){

I want to get Point A and Point B from 3 Edges of a Triangle and eliminate the duplicates with .distinct

Answer Source

You can generate a Stream of all the Points of all the edges using flatMap and remove the duplicates with distinct() :

LinkedList<Point> l =
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download