Tag: Java Coding
Here I am going to show you how to find common, uncommon, unique elements in two Lists or ArrayLists using Java program. In this program I will show you how to find common, uncommon, unique string elements as well as object elements in two ArrayLists. For identifying the unique string elements is very straight forward…
Unique elements by merging arrays In this tutorial, I will show you how to merge string values from two arrays and produce the final array with unique string values. I will use Set data structure to produce the unique results in final array. When passed two arrays of strings, it will return an array containing…
Introduction In this example we will see how to find longest substring from a given string without repeating characters using Java programming language. A given string when broken into substring will have different lengths and we will find the string which has longest length among them. A string may consist of contiguous characters or several…
Introduction In this example we will see how to shuffle an ArrayList using Java programming language. We will use shuffle() method from Collections class to shuffle the ArrayList. We will also create our own method to shuffle the ArrayList. Shuffle means rearrange the elements of the ArrayList by sliding them over each other quickly. So…
Introduction In this tutorial you will see how to reverse a string without affecting special characters using Java programming language. You will also see in this example how to check whether a character is alphabet or digit or special character. Your string may contain special characters such as $, #, @ etc. and you don’t…
Introduction In this example we will see how to find largest product of two elements in an array using Java language. In other hand you can also find those two elements for which the largest product is computed among the elements of an array. The elements are assumed to be integer in an array. The…
Introduction Here you will see an example on how to group objects by their property using Java 8 stream API. GROUP BY is a very useful aggregate operation in SQL, which allows us to group records on certain criteria and Java 8 or later version of Java directly allows you to do GROUP BY in…