
Understanding Collections.reverse() in Java
A list with a set of values can be reversed using the reverse() method. import java.util.*; public class ReverseACollection{ public static void main(String[] args) { List dataList = new ArrayList();

A list with a set of values can be reversed using the reverse() method. import java.util.*; public class ReverseACollection{ public static void main(String[] args) { List dataList = new ArrayList();

The difference is visible when you use the single quote with the + sign. The char value is converted to the ascii value and then summed up. However, you have

If you have multiple strings, you can use StringJoiner to join them efficiently. import java.util.StringJoiner;public class UsingStringJoiner{ public static void main(String args[]) { UsingStringJoiner usingStringJoiner = new UsingStringJoiner(); usingStringJoiner.proceed(); }

See how to use the disjoint method in Collections to find if the given lists are completely disjointed: import java.util.*;public class UsingDisjointInCollections { public static void main(String args[]) { UsingDisjointInCollections

Although using braces is a a common practice, it is sometimes very misleading and it can take hours to figure out what is wrong. A simple way to avoid such

import java.time.*;import java.time.format.*;class LocaleDate{ public static void main(String args[]) { LocaleDate localeDate = new LocaleDate(); localeDate.proceed(); } private void proceed() { DateTimeFormatter formatter; //Creating an instance to the current time

Java has some predefined ways of validating an URL. Here is a code snippet: import java.net.*;public class URLValidator{ String validURL = “http://google.com” ; String inValidURL = “httpgoogle.com” ; public static

The package java.time has APIs to get all the available zone ids. The API is getAvailableZoneIds(). import java.time.*;import java.util.*;public class AllTimeZones{ public static void main(String args[]) { AllTimeZones allTimeZones =

Byte[] pdf = toPdf(file); Here, a method creates a PDF file from some input and returns the binary PDF data as a byte array. This code expects that the generated