Skip to content
Snippets Groups Projects
Verified Commit 7b9c3e42 authored by David Procházka's avatar David Procházka
Browse files

FIX: consistency of stream functions

parent 1b19649a
No related branches found
No related tags found
No related merge requests found
...@@ -70,7 +70,8 @@ public class InternalNode extends Node implements Serializable { ...@@ -70,7 +70,8 @@ public class InternalNode extends Node implements Serializable {
if (getLevel() == level) return Collections.singletonList(this); if (getLevel() == level) return Collections.singletonList(this);
return children.stream() return children.stream()
.flatMap(child -> child.getNodesOnLevel(level).stream()) .map(child -> child.getNodesOnLevel(level))
.flatMap(Collection::stream)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
...@@ -7,6 +7,7 @@ import messif.objects.LocalAbstractObject; ...@@ -7,6 +7,7 @@ import messif.objects.LocalAbstractObject;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -28,7 +29,8 @@ public abstract class Node implements Serializable { ...@@ -28,7 +29,8 @@ public abstract class Node implements Serializable {
public static InternalNode createParent(List<Node> nodes, PrecomputedDistances distances, InsertType insertType) { public static InternalNode createParent(List<Node> nodes, PrecomputedDistances distances, InsertType insertType) {
List<LocalAbstractObject> objects = nodes.stream() List<LocalAbstractObject> objects = nodes.stream()
.flatMap(node -> node.getObjects().stream()) .map(Node::getObjects)
.flatMap(Collection::stream)
.collect(Collectors.toList()); .collect(Collectors.toList());
return new InternalNode(distances.getSubset(objects), insertType); return new InternalNode(distances.getSubset(objects), insertType);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment