-
Notifications
You must be signed in to change notification settings - Fork 7
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
Java updates #1
base: source
Are you sure you want to change the base?
Java updates #1
Conversation
pfarner
commented
Jun 15, 2016
- removed redundant generic type specifications
- favored try-with-resources
- applied streams where that seemed appropriate and the other languages used that style
if (n > 10) | ||
count++; | ||
System.out.println(count); | ||
System.out.println(arr.stream().count()); |
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.
This is not just count, but filtered count. You should count only those values greater than 10. In Python this looks something like this:
sum(1 for i in arr if i > 10)
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.
Thanks, I missed that. Some unit tests might've caught it.
Thank you! I'm thinking about how to manage language versions. I want to keep Java 7 examples. As soon as I decide this I'll merge this PR. |
@evmorov I had same thought, some languages, for example JavaScript drastically differs between versions. I think, language mapping based on file extension should be change on path. This: CODE_EXTENSION = {
'coffee' => 'coffeescript',
'rb' => 'ruby',
'java' => 'java',
'py' => 'python',
'php' => 'php'
}.freeze can be changed to this: CODE_EXTENSION = {
'coffee' => 'coffeescript',
'ruby' => 'ruby',
'java/7' => 'java',
'python/3' => 'python',
'php' => 'php'
}.freeze And files can be organized in to directories, for example:
|