Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
twitch
live-coding-fr
Commits
06db4bbb
Commit
06db4bbb
authored
Jul 26, 2020
by
Colin DAMON
Browse files
Declare Calculator as a static class
parent
f3728963
Changes
1
Hide whitespace changes
Inline
Side-by-side
stringCalculator/src/main/java/fr/ippon/stringcalculator/Calculator.java
View file @
06db4bbb
...
...
@@ -3,7 +3,10 @@ package fr.ippon.stringcalculator;
import
java.math.BigDecimal
;
import
java.util.function.BinaryOperator
;
public
class
Calculator
{
public
final
class
Calculator
{
private
Calculator
()
{
}
public
static
String
sum
(
String
first
,
String
second
)
{
return
operate
(
first
,
second
,
BigDecimal:
:
add
);
...
...
@@ -14,8 +17,8 @@ public class Calculator {
return
operate
(
first
,
second
,
BigDecimal:
:
subtract
);
}
private
static
String
operate
(
String
first
,
String
second
,
BinaryOperator
<
BigDecimal
>
operation
)
{
private
static
String
operate
(
String
first
,
String
second
,
BinaryOperator
<
BigDecimal
>
operation
)
{
notNull
(
first
);
notNull
(
second
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment