What Attilio says is very correct, but I did notice some more ways to improve. #Built-in functions
Built-in functions
If you're using Java 8, you can use streams to simplify your
sumArray
method. Replace the body withreturn Arrays.stream(p).sum();
.The method
copyArray
can be replaced with a call to.clone()
for the same effect.
What Attilio says is very correct, but I did notice some more ways to improve. #Built-in functions
If you're using Java 8, you can use streams to simplify your
sumArray
method. Replace the body withreturn Arrays.stream(p).sum();
.The method
copyArray
can be replaced with a call to.clone()
for the same effect.
What Attilio says is very correct, but I did notice some more ways to improve.
Built-in functions
If you're using Java 8, you can use streams to simplify your
sumArray
method. Replace the body withreturn Arrays.stream(p).sum();
.The method
copyArray
can be replaced with a call to.clone()
for the same effect.
What Attilio says is very correct, but I did notice some more ways to improve. #Built-in functions
If you're using Java 8, you can use streams to simplify your
sumArray
method. Replace the body withreturn Arrays.stream(p).sum();
.The method
copyArray
can be replaced with a call to.clone()
for the same effect.