Main feature are designed,
-to reduce the number lines of code
-use functional programming
Lambda expression -- reduce the function to one line.
Functional Interface -- has only one abstract method
Advantages -- prevent similar function definition somewhere and encapsulation
Predicate Functional interface-- Functional Interface compare boolean which return True or false in one line.
Two Predicate can we joined with And, Or and negate.
Functions -- returns and arguments other than Boolean.
Functional Chaining -- andthen compose
Consumer functional interface-- takes input and put in db or do something but would not return anything
Consumer Chaining -- andthen
Supplier functional interface -- no input just supply something
- had a get() method only and no other static methods
- No chaining in supplier
Bi predicate, bi function and bi consumer takes in two input and produce one output
No true functions no quad functions till now
Streams - arraylist.streams - configuration of streams - filter or map - process that configuration like foreach - all done in same line - sort - multiple threats will be running in the same time to make it efficient
Diamond problem solved by remove @override multiple interface inheritance
Java 11 GCC - memory leaks - good GC algorithm -
Java Flight recorder tool record memory usage & eclipse memory recorder can be used to identify leaks
Dynatrace
How to avoid? Unclosed resources, static variables, circular preferences, week references come on native memory leaks which can occur when native code allocates memory is not released
How to fix memory leaks? Close resources, use weak references, avoid static variables, break circular references, use Java AIDS try with resource statement the automatically close resource, use a memory pool, optimize status structures, you said garbage collector such as G1 garbage collector
Best practices for memory leaks? Follow the single responsibility principle , use dependency injection, avoid complex object graphs, use a memory profiler, test for memory leaks using j unit or testng
Follow solid, where as in single responsibility, open for substitution but close to far modification, liscovs substitution principle, interface segregation, dependency injection.
SOLID principles are a set of design principles intended to make software designs more understandable, flexible, and maintainable. Here's a brief overview of each principle:
Single Responsibility Principle (SRP): A class should have only one reason to change, meaning it should have only one responsibility or job.
Open/Closed Principle (OCP): Software entities should be open for extension but closed for modification. This means you should be able to add new functionality without changing existing code.
Liskov Substitution Principle (LSP): Objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program. Essentially, derived classes must be substitutable for their base classes.
Interface Segregation Principle (ISP): A client should not be forced to depend on interfaces it does not use. This means creating smaller, more specific interfaces rather than larger, more general ones.
Dependency Inversion Principle (DIP): High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions.
Synchronous keyword is used in multithreading where it's protects the simultaneous variable value change
Serialization is when we change object to Jason uses serializable interface, why serialization? To send objects over Network
No comments:
Post a Comment