In this article, we will learn how to use a LinkedHashSet in Java to add and remove elements while maintaining the insertion order. You will see how elements are stored, removed, and updated in a LinkedHashSet without altering the sequence in which they were added. Problem Statement Write a Java program to add elements to a LinkedHashSet, remove specific elements, and display the updated set while ensuring the insertion order of the elements remains unchanged. Below is a demonstration of the same − Input Set = [20, 60, 80, 120, 150, 200, 220, 260, 380] Output Set = [20, 60, ... Read More
A nested class is a class that is declared in another class. The nested class is also a member variable of the enclosing class and has the same access rights as the other members. However, the member functions of the enclosing class have no special access to the members of a nested class. Syntax Here is the basic syntax defining and using nested classes in C++. class OuterClass { // Members of the outer classpublic: // Nested class definition class InnerClass { // Members of the inner class };}; Accessing Nested Classes To access a nested class from outside ... Read More
A class declared inside a function is known as a local class in C++ as it is local to that function, where its scope is limited to that function. Syntax Here the syntax for a local class is given as follows. #include using namespace std; void func() { class LocalClass { }; } int main() { return 0; } In the above syntax, func() is a function, and class LocalClass is defined inside the function. So, it is known as a local class. A local class name can only be used in its function and not outside it. Also, the ... Read More
In C++, a private destructor is a destructor that is declared within a private access specifier, which means that the destructor cannot be accessed or called directly outside the class, which is useful for design patterns where the user wants to control how and when an object will destroy. Syntax Here is the following syntax for a private destructor, which is declared in the class like any other destructor, but with the private access specifier. class MyClass {private: // Private destructor ~MyClass() { }public: // Public constructor MyClass() { // Constructor code here }}; Here we will see what will ... Read More
Node.js is a well-known JavaScript runtime environment used to run JavaScript code on the server side. Using Node.js gives us the ability to execute code on the backend, extending JavaScript beyond just a traditional client side language. With this capability, you can build all kinds of applications that require a server to operate, such as an e-commerce application, a chat application, or even a social media app. Node.js is one of the most popular backend technologies used by developers worldwide to build server applications. In this tutorial, we will go through different ways to install and run Node.js on Ubuntu. ... Read More
Do you want to make your workflow easier on your Windows PC? Using multi-windows or splitting the screen in Windows 11 or 10 is one trick you can use. It doesn’t matter the number of windows opened on your computer, the Snap Windows feature or the multi-window feature lets you easily multitask with all of them. Real-life Example As a writer who often has to research and write at the same time, I often put my document and the source I am researching from (article on the web, or video, or anything else) side by side. Sometimes when there ... Read More
To compare two arrays in Javascript, there are various approaches we can use. We will be understanding various approaches in this article. When comparing two arrays, we cannot use “==” or “===” operator as it compares the addresses of the memory block to which both the arrays are pointing resulting in a false result. In this article we are having two arrays and our task is to compare two arrays in JavaScript. Approaches to Compare Arrays in JavaScript Here is a list of approaches to compare two arrays in JavaScript which we will be discussing in this article with stepwise ... Read More
Both Lumen and Laravel are frameworks used for backend web development. We will discuss what is Lumen, features of Lumen, advantages and disadvantages and applications of Lumen. Similarly we will discuss Laravel in this article. Then we will discuss differences between Lumen and Laravel.What is Lumen?Lumen is framework used for small project. It is micro-framework used in backend web development. We use PHP prorgamming language in Lumen. Lumen is lightweight version of Laravel. Lumen is a open-source framework. You can learn Lumen if you know PHP programming language. Features of LumenThese are various features of Lumen given as below -Composer: It uses Composer for dependency management. We ... Read More
Both Laravel and CodeIgniter are frameworks used to develop backend web development. Both frameworks use PHP programming languages. We will discuss what is Laravel, features of Laravel, advantages and disadvantages and applications of Laravel. Similarly, we will discuss CodeIgniter in this article. Then we will differences between Laravel and CodeIgniter. What is Laravel?Laravel is a framework used in backend web development using PHP programming language. Laravel is a open-source framework with model-view-controller design pattern. Laravel reuses existing components of different frameworks. Laravel provides a rich set of functionalities and features. You can learn Laravel framework easily if you know basic and advanced PHP. A ... Read More
This example demonstrates how to change the color and font of Android ListView using Kotlin. Step 1 − Create a new project in Android Studio, go to File? New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. Example Step 3 − Add the following code to src/MainActivity.kt import android.os.Bundle import android.widget.ArrayAdapter import android.widget.ListView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { var operatingSystem: Array = arrayOf("Android", "IPhone", "WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) title = "KotlinApp" ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP