Java Reference
In-Depth Information
" hello ".trim();
<< "hello"
While monkey-patching built-in objects can seem a good way to add extra or missing
functionality, it can also add unexpected behavior. You should think very carefully before
monkey-patching any of the built-in object constructor prototypes. Further problems could
occur if the method you've added is then implemented natively in the language.
If you do decide to do it, the suggested way is to check for built-in methods first and then
try to mimic the built-in functionality from the specification. This can still be problematic,
though, if the specification changes and is different from your implementation. Remember
also that you can never guarantee that a method won't be implemented at some point in the
Search WWH ::

Custom Search