Skip to content

Commit 2aa4c96

Browse files
authored
Update README.md (iluwatar#1598)
Factory method is updated with real world examples
1 parent 8632962 commit 2aa4c96

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

factory/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ Cons
126126

127127
* The code becomes more complicated than it should be.
128128

129+
## Real world examples
130+
131+
* [java.util.Calendar#getInstance()](https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#getInstance--)
132+
* [java.util.ResourceBundle#getBundle()](https://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html#getBundle-java.lang.String-)
133+
* [java.text.NumberFormat#getInstance()](https://docs.oracle.com/javase/8/docs/api/java/text/NumberFormat.html#getInstance--)
134+
* [java.nio.charset.Charset#forName()](https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html#forName-java.lang.String-)
135+
* [java.net.URLStreamHandlerFactory#createURLStreamHandler(String)](https://docs.oracle.com/javase/8/docs/api/java/net/URLStreamHandlerFactory.html) (Returns different singleton objects, depending on a protocol)
136+
* [java.util.EnumSet#of()](https://docs.oracle.com/javase/8/docs/api/java/util/EnumSet.html#of(E))
137+
* [javax.xml.bind.JAXBContext#createMarshaller()](https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/JAXBContext.html#createMarshaller--) and other similar methods.
138+
129139
## Related patterns
130140

131141
* [Factory Method](https://java-design-patterns.com/patterns/factory-method/)

0 commit comments

Comments
 (0)