Important New Features in java 8...... 1) forEach() method in Iterable interface Whenever we need to traverse through a Collection, we need to create an Iterator whose whole purpose is to iterate over and then we have business logic in a loop for each of the elements in the Collection. We might get ConcurrentModificationException if iterator is not used properly. Java 8 has introduced forEach method in java.lang.Iterable interface so that while writing code we focus on business logic only. forEach method takes java.util.function.Consumer object as argument, so it helps in having our business logic at a separate location that we can reuse. Let’s see forEach usage with simple example. 2) default and static methods in Interfaces If you read forEach method details carefully, you will notice that it’s defined in Iterable interface but we know that interfaces can’t have method body. Fro...
Posts
Showing posts from May, 2017
- Get link
- X
- Other Apps
JavaScript Promises.... A promise represents the eventual result of an asynchronous operation. It is a placeholder into which the successful result value or reason for failure will materialize. Promises provide a simpler alternative for executing, composing, and managing asynchronous operations when compared to traditional callback-based approaches. They also allow you to handle asynchronous errors using approaches that are similar to synchronous try/catch. Promise States Pending - the promise’s outcome hasn’t yet been determined, because the asynchronous operation that will produce its result hasn’t completed yet. Fulfilled - the asynchronous operation has completed, and the promise has a value. Rejected - the asynchronous operation failed, and the promise will never be fulfilled. In the rejected state, a promise has a reason that indicates why the operation failed. When a promise is pending, it can transition to the fulfilled or rejected state. Once a p...
- Get link
- X
- Other Apps
How to link WebStorm IDE with GitHub windows application The main advantage of link WebStrom with GitHub windows application is you can do the version controlling directly through the WebStorm IDE. When you are doing a project using WebStorm IDE you can use git command which are use to version controlling in the IDE it self, if you have linked with GitHub windows application. Now will see how to link WebStorm IDE with GitHub windows application.. step 1) Install WebStorm IDE. step 2) install GitHub windows application and clone with the project which is in the GitHub or GitLab repository. step 3) Open that project using WebStorm. IF you have done those three step already follow these steps to link WebStorm and GitHub windows application. step 4) Go to this file path and copy it. C drive -> Users -> <your user file> -> Appdata -> Local -> ...