Effective Java (2nd Edition): Joshua Bloch: 9780321356680: Amazon.com: Books

Please Visit: http://ift.tt/1ajReyV



Replace Constructor with Factory Method from Effective Java Second Edition

Static factory methods can have different name than class whereas constructors cannot.

Static factory methods, unlike constructors, they are not required to create a new object each time they’re invoked.

Static factory methods, unlike constructors, they can return an object of any subtype of their return type.

Static factory methods reduce the verbosity of creating parameterized type instances.

http://ift.tt/1gjlDmE



from Google Plus RSS Feed for 101157854606139706613 http://ift.tt/1gjlDmE

via LifeLong Community

No comments:

Post a Comment