Impact of interface’s default method on multiple inheritance (Java 8 /example)
Java 8 has introduced default method for interfaces, which provides the default implementation of method. Prior to java 8 interfaces […]
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
Given user defined object or POJO, we would like to serialize object in java. We will use Externalizable interface, so that
Custom thread pool implementation in java example without executor framework. Create thread class & thread pool using blocking queue (example)
Given a base & concrete class in java. Base class is not Serializable Concrete class implements Serializable interface and extending
Given a base & concrete class in java. Base class is Serializable (implements Serializable interface). Concrete class is extending the
Serialization is the process of saving the objects loaded in the memory to corresponding streams. e.g Save the objects to
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 the code or functional block of program , we would like to find elapsed time, to execute the code
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.
We have already discussed about the basics of Threads in java. Now we will discuss about creation process in java.
How we can create threads in java
Extending a class
Implementing a interface:
1. Background of Serialization & Deserialization process: Before we start our discussion about the Serialization and Deserialization, We will discuss
Thread Pool : Thread pool is collection of threads which are created to complete certain tasks.
The interaction between thread pool and task is as follows
1.) Thread Pool is created
2.) Task are created.
3.) Task assigned to Thread in thread pool.
Thread Pool : Thread pool is collection of threads which are created to complete certain tasks.
The interaction between thread pool and task is as follows
1.) Thread Pool is created
2.) Task are created.
3.) Task assigned to Thread in thread pool.
Everybody in this world is performing one duty or the other.The duties we are performs is like the functional activity of bigger execution block. Let us shrink our vision and take one house to understand. In traditional family environment husband involves in earning to maintain day to day expenses and wife involves in house hold activitie
The person or device that is capable of serving is called the Server. In our day to day life we come across various servers. We generally purchase vegetable or fruits from a vendor (Shopkeeper / hawker). We request the shopkeeper for required vegetables/fruits. The shop keeper provides us the required vegetable or fruits. We ask the shopkeeper and he provides us the food items. So, Shopkeeper is at our service, which fulfills our need.