New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code cleanup in ViewHelpers #941
Conversation
final Optional<String> title = TITLE_PROPERTIES.stream().map(Property::asNode).flatMap(p -> listObjects( | ||
graph, sub, p).toList().stream()).filter(Node::isLiteral).map(Node::getLiteral).map( | ||
LiteralLabel::toString).findFirst(); | ||
return title.orElse(sub.isURI() ? sub.getURI() : sub.isBlank() ? sub.getBlankNodeLabel() : sub.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personally, I find it easier to read if the expressions are on separate lines:
list.stream()
.map(func1)
.flatMap(func2)
.collect(func3);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this make #938 unnecessary? I'm fine with that, but there is a unit test in that PR (for titles containing URIs) that should be pulled in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm definitely not of the opinion that line-per-call is more readable, but this is a matter of style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, does look like a conflict with #938. Can you rebase over this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, cool. I'll wait to pull the trigger on #938, which otherwise looks good to me
https://jira.duraspace.org/browse/FCREPO-1813