What is an Observer Design Pattern

The Observer pattern is a behavioral design pattern that  allows an object (an Observer) to watch another object (a Subject). The subject and observer to have a publish/subscribe relationship. Observers can register to receive events from the Subject. Some of the practical uses of observer pattern are: When a change to one object requires changing … Read more

How Many Types of Relationship Exist in Database Designing

There are three major relationship models:- One-to-one One-to-many Many-to-many In the context of Core Java or any programming language, the number of relationship types in database design is not specifically related to the language itself. Instead, it is a concept in database management systems (DBMS). In the context of database design, relationships between tables are … Read more

Performance of List Interface Implementations

LinkedList Performance of get and remove methods is linear time [ Big O Notation is O(n) ] – Performance of add and Iterator.remove methods is constant-time [ Big O Notation is O(1) ] ArrayList The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. [ Big O Notation is O(1) ] – … Read more

Performance of Set Interface Implementations

HashSet The HashSet class offers constant-time [ Big O Notation is O(1) ] performance for the basic operations (add, remove, contains and size), assuming the hash function disperses the elements properly among the buckets. Iterating over this set requires time proportional to the sum of the HashSet instance’s size (the number of elements) plus the … Read more

Performance of Map Interface Implementations

Hashtable An instance of Hashtable has two parameters that affect its performance: initial capacity and load factor. The capacity is the number of buckets in the hash table, and the initial capacity is simply the capacity at the time the hash table is created. Note that the hash table is open: in the case of … Read more