Programming
HomeProgramming
Programming has always been a fun and intriguing activity! Here are my programming blog posts based on day-to-day experience and adventures with the programming languages and toolset.
Also includes a curated list of beginner-friendly tutorials, examples as well as real-world challenges and problem-solving methods. Currently includes Java, Maven, Hibernate, VB, etc., and still growing.
- Advertisement -
- Advertisement -
- Advertisement -
JAVA
HIBERNATE
VBSCRIPT
MAVEN
PROGRAMMING POSTS
How To Remove Duplicates From List in Java
Introduction A List is an interface in the Java collection framework which can be used to store a group of objects. A List is ordered and it allows duplicates. However, there are often scenarios where you would need to eliminate duplicate elements from a List. There are several ways you can...
Convert List to Array Using ToArray Without Param
Java provides a toArray method on the 'List' interface. This can be used to convert a 'List' to an array. Since there are are two overloaded versions, one of these method is explained below. This toArray method does not accept any input parameters. It returns an object array. The following...
Remove Duplicates from List Using LinkedHashSet
Another implementation of the Set interface is LinkedHashSet. LinkedHashSet maintains the order of elements and helps to overcome the HashSet limitation. The following code demonstrates this: This code is quite similar to the one seen earlier, except that it uses a LinkedHashSet. The input List is passed as a parameter...
Java Tutorial #1 – Variables and Data Types
Table of Contents Introduction 1. Variables 2. Data Types Primitive Data Types Integer Data Types Decimal Data Types Character Data Types Boolean Data Types Reference Data Types Introduction Variables are names that are used to identify memory locations that store values. Each variable belongs to a particular data type. Data types determine...
- Advertisement -
Convert List to Array Using Stream with Param
There is an overloaded version of the Stream.toArray method which can be used to return a result array that is of the same data type as the input array. The following code demonstrates this: Firstly, the 'stream()' method is invoked on the input List which returns a Stream corresponding to...
Remove Duplicates from List Using HashSet
The Set is also an interface in the 'Java Collection' framework. Unlike a List, a Set does not allow duplicates. Hence you can use a Set to eliminate the duplicates in a List. There are several ways in which you can use a Set to eliminate duplicates as...
How To Convert List To Array in Java
A common scenario faced by programmers is to convert a Java List to an Array. A 'List' is part of the Collection Framework and is useful when the number of elements are unknown. An 'Array', on the other hand, is useful for fixed-size elements. However, in real-world programming, there are...
Convert List to Array Using Stream without Param
Java 8 has added the Stream API that helps to easily perform bulk operations on Collections. A new method called stream() has been added to all the collection interfaces that returns a Stream corresponding to the underlying collection. There is a toArray method available on the Stream interface that can...
- Advertisement -
Remove Duplicates from List Using For-Loop
The simplest way to remove duplicates from a 'List' is to use a for-loop. The following code snippet demonstrates this method. First, the code creates a new ArrayList to store the output, i.e. a List without duplicates. A for-loop is then used which iterates through the input List. It first...
Convert List to Array Using For-Loop
The simplest way to convert a List to an array is to use a for-loop. The following code snippet demonstrates this method. First, the code creates an Array based on the number of elements in the input List. A for-loop is then used which iterates through the input List and...
How To Auto-launch VBscript with Elevated Privileges
For cases when you need to execute a VBS script (*.vbs file) as admin with elevated privileges you can try the following snippet. This can be done by running ShellExecute and setting the runas flag to run an executable or to run an entire script (batch file or VBScript)...
CODE GISTS
Concatenate Strings Using Plus Operator
In Java, a String is a sequence of characters. There are often programming situations where you will need to concatenate Strings. There are several...
Common Git Commands Reference
Git is the most popular distributed version control system which is currently an actively maintained open-source project. Git supports many command-line tools and graphical...
Concatenate Strings Using String.join() for Collections
There is an overloaded version of the String.join method that accepts as parameter an Iterable implementation. Since all Collection classes implement the Iterable interface,...
Common OpenSSH Commands Reference
Secure Shell, sometimes referred to as Secure Socket Shell (SSH), is a protocol which allows you to connect securely to a remote computer or...