I have seen a lot of interviewers asking for the internal working mechanism of the hashmap. If you know the complete internal working of one of the map implementations, it becomes easier for you to understand the other classes of the map interface.
So thru this article, we’ll see how the hashing is done and its complete working mechanism, how the
removeoperations work with the hashmap and their time complexities, and at the end, we’ll see why it should not be used in a multi-threading environment.
Basically, HashMap is one of the most popular Collection classes in…
Through this article we are going to discuss atomic variables in java, why and where are they used, and how synchronized, volatile and atomic are different. Okay, okay don’t get confused, I’ve already covered synchronization and volatile in detail.
But before going ahead, you should know Race Condition, Critical Section, and Context Switching between threads. I have already covered these concepts and their examples in detail in the below articles. You should go thru them to get a complete and clear understanding of these concepts. Anyway, after reading these articles you will realize multi-threading is not that difficult.
Through this article, we’ll learn what are indexes, why to use them, how to create them, and when to avoid them. The concept of indexes is mostly asked in the interviews which are focused on SQL.
Indexes are a special kind of lookup table that is used by the database search engine to speed up data retrieval from the tables. Basically, an index is a pointer that points to the tuples of a table.
An index in a database is very similar to an index in the back of a book. It means when we want to jump to a…
Through this article, I will be discussing the concept of Encapsulation and how we can achieve it in java programming. After reading this article you would be in a position to understand and implement encapsulation into your next java application.
Encapsulation is a mechanism of wrapping the data (instance variables) and code acting on the data (instance methods) together as a single unit(i.e. class).
In encapsulation, the variables of a class will be hidden from other classes(i.e. the other classes of the package and outside the…
I have seen many developers a bit confused when it comes to multi-threading. This is primarily because a lot of things happen in the background and many concepts are related to it. You should know Race Condition, Critical section, and Context Switching between threads. I have already covered these concepts and their examples in detail.
In this article, I’ll be covering two important keywords synchronized and volatile, and their proper usage. …
Please go thru this link https://app.diagrams.net/
You will find a lot of useful control and features to create your own diagram. I mostly create almost all my diagrams from here.
You can also find video tutorials on you-tube for reference initially. Once you start creating diagrams you would love this platform.
JDK 5.0 introduces several new extensions to the Java programming language. One of these is the introduction of Generics. Through the medium of this article, I’m going to discuss what generics are, how to use them in Java, and their advantages. Having sound knowledge of generics will help you clear your next java interview.
ClassCastExceptionthat was common when working with collection classes earlier.
Let’s see an…
In SQL, a view is a virtual table that is based on the result-set of an SQL query.
A view has rows and columns similar to a real table. The columns or the fields of the view are picked from one or more real tables of the databases.
You can add SQL statements and functions to a view and present the data as if the data were coming from one single table.
A view is created with the
CREATE VIEW statement.
CREATE VIEW view_name AS
SELECT column1, column2, …
A view always shows up-to-date data. Every…
Through this article, we’ll learn what is Group by and Having clauses, when to use these clauses and how they are different than the where clause. The questions on these two clauses are mostly asked in the interviews that are focused on SQL.
The SQL GROUP BY clause is often used with the
SELECT statement to group or arrange the rows together into multiple groups based on certain column(s) values. This
GROUP BY clause follows the
WHERE clause in a
SELECT statement and precedes the
ORDER BY clause.
The GROUP BY statement is often used with aggregate functions to group…
The difference between TRUNCATE, DELETE, and DROP is one of the most common interview questions that are focused on SQL. Through the medium of this article, we’ll learn their differences and syntax.
TRUNCATE TABLE the command deletes the data inside a table, but not the table itself.
TRUNCATE deletes all the rows of a table at once. It only logs once in the transaction log.
The following SQL truncates the table ‘Categories’:
TRUNCATE TABLE table_name;
Few important points: