Skip to content Skip to sidebar Skip to footer

What Is A Convenience Method In Java?

I am told that the Activity.findViewById(int) method is a convenience method that calls View.findViewById(int) behind the scenes. I am unable to find any documentation for explain

Solution 1:

A convenience method, in any language which has a concept of methods, is just that. A method that makes things more convenient.

This usually means taking something that is complex or verbose, and making it more accessible. Examples include pretty much everything in helper classes like Collections or Arrays. As well as factory methods (to a certain extent, there are reasons for factories beyond simple convenience).

For a more formal definition from Wikipedia (http://en.wikipedia.org/wiki/Convenience_function):

A convenience function is a non-essential subroutine in a programming library or framework which is intended to ease commonly performed tasks.

Post a Comment for "What Is A Convenience Method In Java?"