Skip to content

Conversation

AngeloBusato
Copy link
Contributor

No description provided.

@UserFunction
@Description("apoc.coll.different(values) - returns true if values are different")
public boolean different(@Name("values") List<Object> values) {
for(int i=0; i<values.size()-1;i++){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always use foreach
this one is just return new HashSet(values).size() == values.size()

@Description("apoc.label.exists(element, label) - returns true or false related to label existance")
public boolean exists(@Name("node") Object element, @Name("label") String label) {

return element instanceof Node?((Node) element).hasLabel(() -> label) :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while the lambda approach is cool, I'm not sure if it's more efficient htan just using Label.label(label)

return degree;
}

@UserFunction("apoc.node.degree.in")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just use node.getDegree(type, direction)
please no manual counting.

}

}
private long getTotalNeighbors(Node node, String types, Direction direction) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

@jexp
Copy link
Member

jexp commented Jul 20, 2018

Thanks a lot!

@jexp jexp merged commit f0d772b into neo4j-contrib:3.4 Jul 20, 2018
jexp pushed a commit that referenced this pull request Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants