My Quick Learnings

1. Serialization in Java

a. Serialization is the process of converting objects to bytes.

b. Serialization is achieved by using "Serializable" interface
c. It makes storing and sending objects easy.

2. Static Nested classes

a. A nested class is a member of the enclosing class
b. Non static nested classes can access other members of the class even if they are private
c. Static nested class cannot access other members of a class, so in effect a static nested class is a top level class that is inside another top level class for packaging convenience.

3. Wrapper classes over Primitive data types

a. Whenever we use collections
b. It is easy to initialize objects to null or send null parameters to a function/constructor to indicate the state or function. This cannot be done with primitives, many developers initialize numbers to either 0 or -1 to signify this but in most cases it is misleading or incorrect.

4. How to add a list to the end of another List

listA.addAll(listB);


5. Unique elements from a list of Objects.

a. Use a HashSet Set uniqueSet = new HashSet <> (List phaseList);
b. Don't forget to override the equals and hashcode methods in PhaseDto class.

No comments:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days