Hi,
Hope you are all doing great. Let's learn together.
Join Telegram: 📲 https://t.me/contactajoydebnath
Chapters ❤
0:00 Introduction
00:55 String Immutable and StringBuffer & StringBuilder Mutable
05:53 Immutable Design Pattern Theory and Code Implementation
21:06 When to use DeepCopy (In Constructors ) in Immutable Design Pattern
30:33 When to use DeepCopy (In Getter Method) in Immutable Design Pattern
45:25 Stackoverflow link
Note:
Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Before Java, its name was Oak. Since Oak was already a registered company, James Gosling and his team changed the name from Oak to Java.
Stackoverflow Link :
https://stackoverflow.com/questions/1...
Document Link -
https://docs.google.com/document/d/1m...
STS Link:
https://spring.io/tools
JDK Link:
https://www.oracle.com/java/technolog...
Video Links:
String Playlist :
• Spring Framework
Java Videos Links :
Object Cloning, Shallow Copy and Deep Copy. -- • Object Cloning, Shallow Copy, and Deep Cop...
Excetption, Custom Exception, throw, throws -- • Exception, Custom Exception, throw, throws...
Excetption, try, catch, finally -- • Exception, Propagation try, catch, finally...
Exception, Exception Hierarchy, Call Stack, Propagation. Bengali-Ep:22 -- • Exception, Exception Hierarchy, Call Stack...
Lambda Expression, Functional Interfaces, Anonymous Class. -- • Lambda Expression, Functional Interfaces, ...
Singleton Pattern. Lazy Instantiation for Multiple Threads.Part-2 Bengali-Ep:20 • Singleton Pattern. Lazy Instantiation for ...
Singleton Design Pattern in Java. Early & Lazy Instantiation Bengali-Ep:19 : • Singleton Design Pattern Java. Early & Laz...
HashSet, Its Methods & How It Works Internally in Java : • HashSet, Its Methods & How It Works Intern...
HashSet & How It Works Internally in Java. -- • HashSet & How It Works Internally in Java....
LinkedList,Methods & How It Works Internally in Java. -- • LinkedList, Methods & How It Works Interna...
ArrayList, ListIterator, How It Works Internally -- • ArrayList, ListIterator, How It Works Inte...
Collection Framework ---- • Collections Framework, Collection & Iterat...
'super' keyword - • 'super' keyword in Java. Bengali-Ep:13 #b...
'this' keyword - • 'this' keyword in Java. Bengali-Ep:12 #be...
Final Keyword - • Final keyword, Final variable, method, cla...
Static Keyword, Static variable, block, method, nested class - • Static keyword, Static variables, block, m...
Access Modifier. Private, Public, Default, Protected -- • Access Modifier. Private, Public, Default,...
Encapsulation, Data Hiding, Setter-Getter method, JavaBean Class -- • Encapsulation, Data Hiding, Setter-Getter ...
Polymorphism, Method and Constructors Overloading, Method Overriding -- • Polymorphism, Method & Constructors Overlo...
Inheritance, Is-A relationship, the problem with multiple inheritances -- • Inheritance, 'IS-A' relationship, multiple...
Abstraction, Interface -- • What is Abstraction? Interface Implementat...
Abstraction, Abstract Class - • What is Abstraction? Abstract Class Implem...
What is Class, Object, Method, Constructors- • What is Class, Object, Method, Constructo...
Environment Setup and why we need to set path in environment variable -- • Environment Setup. Why do you set a Java p...
First Java Program - "Hello World" -- • First Java Programming "Hello World" Print...
Like, Comment, Share, and Subscribe.
Thank you again.
Immutable Design Pattern :
Immutable class in java means that once an object is created, we cannot change its content.
In java, all the wrapper classes (like Integer, Boolean) and String class are immutable.
Now we are going to create our own immutable class as well.
1. The class must be declared final so that child classes can’t be created.
2. Data members in the class must be declared private, so direct access is not allowed.
3. Data members in the class must be declared as final so that we can’t change their value of it after object creation.
4. A parameterized constructor should initialize all the fields performing a deep copy so that data members can’t be modified with an object reference.
5. Deep Copy of objects should be performed in the getter methods to return a copy rather than replacing the actual object reference)
There should be no setters method or in simpler terms, there should be no option to change the value of the instance variable.