Hot answers tagged

2 votes

Java - Should I use getter in method?

The name subscription suggests to me that the field contains detailed information about a subscription to some service. A subscription is not inherently a true-...
TorbenPutkonen's user avatar
1 vote
Accepted

Redouble each occurrence of char recursively, and add n

You can calculate the number of doublings instead of looking it up in a map. The code below is otherwise copied from @Roman's answer. ...
Rainer P.'s user avatar
  • 2,622
1 vote

Redouble each occurrence of char recursively, and add n

Nested If-Statements You can simplify the code and improve the readability as a result. It is achievable by using the Guard Pattern which in short can break off nested if-statements by inverting the ...
Roman's user avatar
  • 2,783
1 vote

Java - Should I use getter in method?

Both are fine. Just in first case scenario you could use the getter if needed by some other feature.
Sofia Chardin's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible