Dependency Injection

This is fully to provide the approach of loosely-coupled. the more objects depend on each other, the harder it gets to implement a new functionality. Service classes will be handling the changes and the end consumer will not be affected by the changes made. Like the end consumer will create/inject the service objects implementations of

Race Condition

Running multiple threads are fine, but the issue arises when multiple access to the same resource e.g. memory component a variable, array, or a database system web service. The key issue is multiple threats to alter the same resource. If there is no alteration in the target resource, then multiple threads are good.  Example situation

Process and Thread

Process A process runs independently and isolated of other processes. It cannot directly access shared data in other processes. The resources of the process, e.g. memory and CPU time, are allocated to it via the operating system. Thread Threads are sometimes called lightweight processes. Both processes and threads provide an execution environment, but creating a

Enumerator, Iterator and ListIterator

Enumeration and Iterator Operation Enumeration Iterator Speed Faster Slower Object removal from collection N/A Available Iterator and ListIterator Operation Iterator ListIterator Traverses List, Set and Map Only List Direction Forward only Backward Forward both Guaranteed order of iteration N/A Available Add N/A Available

Collection Interface and Data Structures in Java

Collection Interface Introduction Collections know also as Data Structures are the fundamentals of each and every programming language. Java provides many of useful data structure for different scenarios and needs. In this blog post I’ll cover only mostly used collections as well as keep things simple, not dive into methods and their details. Because those