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
Concatenate Strings Using String Joiner
Java 8 has added a new class called StringJoiner. This concatenates Strings using a delimiter as well as adds a prefix and suffix to the concatenated String. Performance-wise, it is similar to StringBuffer.append, but it has the added advantage that it automatically adds a delimiter, prefix and suffix. The following...
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, this method can be used to concatenate all the elements in a Collection. The following code demonstrates this: This code creates a List of String values...
Concatenate Strings Using String.join()
Java 8 has added a static join method to the String class. This concatenates Strings using a delimiter. Performance wise, it is similar to StringBuffer.append, but it has the added advantage that it automatically adds a delimiter. As before, this code creates string1 and string2. It invokes the join...
Concatenate Strings Using StringBuilder.append()
In addition to String, Java has the java.lang.StringBuffer and java.lang.StringBuilder classes. These can also be used to concatenate Strings. The advantage of these classes is that both these classes are mutable, so using them does not result in the creation of new String objects. So StringBuffer and StringBuilder...
- Advertisement -
Concatenate Strings Using StringBuffer.append()
In addition to String, Java has the java.lang.StringBuffer and java.lang.StringBuilder classes. These can also be used to concatenate Strings. The advantage of these classes is that both these classes are mutable, so using them does not result in the creation of new String objects. So StringBuffer and StringBuilder...
Concatenate Strings Using String.concat()
The String class has a method called concat. It accepts as parameter a String value and concatenates it with the current String. The following code demonstrates this: As before, this code creates string1 and string2. It then invokes the concat() method on string1 and passes string2 as an argument....
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 ways in which you can achieve this. The + operator is also known as the concatenation operator. It can be used to concatenate Strings. The...
Remove Duplicates from List Using Stream
Java 8 has added the Stream API that helps to easily perform bulk operations on Collections. A new method called stream() method has been added to all the collection interfaces that returns a Stream corresponding to the underlying collection. The Stream interface has a method called distinct that can...
- Advertisement -
Java Tutorial #2 – Operators in Java
Table of Contents Introduction 1. Assignment Operator 2. Arithmetic Operators 3. Compound Operators 4. Increment & Decrement Operators 5. Relational Operators 6. Logical Operators Introduction Operators are an essential part of any programming language. In-fact it is not possible not to write a decent piece of code without making use of 'Operators'. Java operators...
Convert List to Array Using ToArray With Param
There is an overloaded version of the toArray method. This accepts an array as a parameter and returns a result array that is of the same data type as the input array. So basically, this toArray method can be used to obtain an array that is of the same data type...
Remove Duplicates from List Using Set.addAll
The Set interface has a method called addAll. This accepts a 'Collection' as the parameter. So if you invoke this method by passing the 'List', the duplicates will be eliminated. The following code snippet demonstrates this method. Here, a new LinkedHashSet is created and the addAll method is invoked by...
CODE GISTS
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...
Format Decimal Numbers Using Format Symbols
You can customize which symbols are used as decimal separator, grouping separator, currency seperator etc. using a DecimalFormatSymbols instance together with java.text.DecimalFormat class. The...
How To Change Your Default Linux Shell
The shell is a program that accepts and interprets commands. Besides bash, Linux supports many other shell programs, such as ksh, zsh, csh, and...
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...