Join or concatenate or combine multiple strings in java (example)
1. Different methods to join or concatenate strings in java Join String using + operator Combine String using String concat method Contact String […]
1. Different methods to join or concatenate strings in java Join String using + operator Combine String using String concat method Contact String […]
Java stream library have streams specifically for primitive types like int, long, double etc. With primitive streams, values are directly
Java 8 Stream: groupBy, mapping and statistics, lambda stream example. Discussed IntSummaryStatistics (min,max,avg) of List of Person objects.
Given a list of user defined objects, we would like to convert list of pojo objects to JSON (and JSON to list
Given an array of user defined objects, we would like to convert array of object to JSON and JSON to array
Given Map of String & object (Map<String,Object>), we would like to convert Map to/from JSON. We will use the jackson’s objectmapper to serialize
Given the list of objects, convert list of objects to map. We will use lambda streams to convert list objects
Given the user defined object or POJO, having Date field, we would like to serialize the POJO to JSON. During serialization, we would
Given an list of user defined objects, we would like to convert list of pojo objects to JSON (and JSON to list
Given an array of user defined objects , we need to convert array of POJOs to JSON String. Also, we will convert
Given the Map of String and object (Map<String,Object>), we would like to convert Map to JSON and vice versa. We will use the
1. Read file using java 8 lambda stream Given a file, read input file by line by line using lambda
Java 8 has introduced default method for interfaces, which provides the default implementation of method. Prior to java 8 interfaces
1. What is functional interface in java8? The interface having one abstract method is called functional interface. The interface can
1. Functional Interface java 8: The interface having one abstract method is called the functional interface. E.g. Comparator, Runnable interface.
Given a user defined object, we would like to convert Object( or POJO) to JSON and vice versa. We will use the Google gson
Given the arraylist of user defined objects or POJO (let we have person class). List <Person> personList Find or Search
Given an arraylist collection of String objects, We would like to find object from arraylist. We will iterate through the list of
Given a the list of objects, we need to sort the objects by their multiple properties. We have used java 8 streams to sort the objects. In below example, we have take the Person object. We will sort the list of person objects by their firstName. Also we have shown the cascaded sorting wherein we have sorted the list on multiple fields.We have performed the following operations.
Given the strings of array containing nulls and empty string. We will be using Java 8 streams to filter out null and empty string in strings of array. Let us take a complete example to filter out null and empty string
Suppose we are given the List collection containing the String values, we will remove the null values from list collections using filter of Java 8. Let us take a look into the below example
Generally in our application we need to convert one object into another type. We can not directly transform one object to another. In traditional way we need to iterate source object and convert to destination object. We will be using Java 8 lamdas to translate one object into another.
Java 8 have StringJoiner class which will be used to join strings using delimiter. Also we can combine strings using prefix and suffix strings.