Hot answers tagged

4 votes

Recursive palindrome check

As Toby points out, your use of String.substring() is very expensive. It creates a new String object for each call, and (...
  • 1,472
4 votes
Accepted

Recursive palindrome check

Your handling of base cases is somewhat redundant. ...
  • 5,363
2 votes
Accepted

Calculator (Java/Beginner)

For a beginner this isn't terrible, but unfortunatly from a OOP point of view it's structured quite badly. First i'm going to concentrate on the Database class. (...
  • 10.6k
2 votes

Recursive palindrome check

You are creating lots of strings. If you pass a view of the substring (i.e. pass a string reference and a pair of indices) into the recursive call, you will reduce your garbage creation to almost nil....
  • 67.6k
1 vote

IPv4 filter in Java

The IPFilter class The implementation appears to be simple. The IPFilter class includes methods for adding and removing IPv4 addresses from the filter, as well as methods for determining whether an ...
  • 11

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