Skip to content
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

Merged
merged 1 commit into from Nov 4, 2015
Merged

Code cleanup in ViewHelpers #941

merged 1 commit into from Nov 4, 2015

Conversation

ajs6f
Copy link
Contributor

@ajs6f ajs6f commented Nov 3, 2015

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());
Copy link
Contributor

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);

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

w/r/t #938 it seems that merging this PR first and rebasing #938 over this works for me.

Copy link
Contributor Author

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

acoburn added a commit that referenced this pull request Nov 4, 2015
Code cleanup in ViewHelpers
@acoburn acoburn merged commit 41c28a5 into master Nov 4, 2015
@acoburn acoburn deleted the fcrepo-1813 branch November 4, 2015 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants