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

optimized random value generators #1700

Merged
merged 1 commit into from
Nov 23, 2016
Merged

optimized random value generators #1700

merged 1 commit into from
Nov 23, 2016

Conversation

danieldietrich
Copy link
Contributor

@danieldietrich danieldietrich commented Nov 22, 2016

INFO: This PR contains a backward compatible API change:

interface Gen<T> {
-    static Gen<Character> choose(char[] characters) {
+    static Gen<Character> choose(char... characters) {
}

@codecov-io
Copy link

codecov-io commented Nov 22, 2016

Current coverage is 97.03% (diff: 100%)

Merging #1700 into master will increase coverage by 0.01%

@@             master      #1700   diff @@
==========================================
  Files            89         89          
  Lines         11264      11268     +4   
  Methods           0          0          
  Messages          0          0          
  Branches       1878       1876     -2   
==========================================
+ Hits          10928      10934     +6   
+ Misses          196        195     -1   
+ Partials        140        139     -1   

Powered by Codecov. Last update 2625b10...708434e

if (n <= k) {
return freqGen._2;
} else {
n = n - k;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok for me - it is performed on a copy on the stack. Btw - when dealing with immutable objects (like in Javaslang), then nothing evil can happen at all!

@@ -424,3 +413,27 @@
return f.apply(this);
}
}

final class GenModule {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix that

if (n <= k) {
return freqGen._2;
} else {
n = n - k;

Choose a reason for hiding this comment

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

[Checkstyle] ERROR: Assignment of parameter 'n' is not allowed.

@danieldietrich danieldietrich merged commit 507654a into vavr-io:master Nov 23, 2016
@danieldietrich danieldietrich deleted the gen-opt branch November 23, 2016 07:24
@danieldietrich danieldietrich modified the milestones: 2.0.6, 2.1.0 Mar 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants