Question
When do you use Flyweight pattern?

Answers

This is another popular question from the design pattern. Many Java developers with 4 to 6 years of experience know the definition but failed to give any concrete example. Since many of you might not have used this pattern, it's better to look examples from JDK. You are more likely have used them before and they are easy to remember as well. Now let's see the answer.
Flyweight pattern allows you to share object to support large numbers without actually creating too many objects. In order to use Flyweight pattern, you need to make your object Immutable so that they can be safely shared. String pool and pool of Integer and Long object in JDK are good examples of Flyweight pattern.   Your Comment




More Software Questions..
What is the inputsplit in map reduce software?

What is software configuration management?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?

What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?

Which oracle package is used to manage the oracle lock management services?

What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?

What is marker interface?

What types of partitioning are there for BW?



Search
Can you Answer!!
  • Q What is the difference between a virus and a trojan?
  • Q How should we measure your success at the end of your time here?
  • Q Greenhouse gas effect on Earth?
  • Q How do i implement vtp in a nexus 7000 series switch where vlans are manually configured?
  • Q Explain 2 VF pages developed by you?
  • Q What is desensistisation? (in terms of receptor and drug binding)
  • Q The working of SEBI includes ___?
  • Q When does the sun reaches its maximum angular distance from the equator?
  • Q What is big particle accelerator on the French-Swiss border, restarted in 2009 after extensive repairs?
  • Q Which scientist was known as 'Wizard of Menlo Park'?
  • Q Which political reforms would you suggest to the government of India?