How to calculate Large Factorials using BigInteger in Java? Example Tutorial

Factorial of numbers greater than or equal to 13 cannot be found using primitive int data type as shown in our earlier factorial solution due to overflow. These factorials are too large to fit in an int variable, whose maximum value is just 2147483647 (2^31 -1). Even if we use the long data type, factorials greater than or equal to 21 will generate an overflow. To find the factorial of anything above 21, you need to use the BigInteger class from java.math package. 

How to use Lock and ReentrantLock for Synchronization in Java - Example Tutorial

Many Java programmers confused themselves like hell while writing multi-threaded Java programs like where to synchronized? Which Lock to use? What Lock to use etc. I often receive a request to explain how to use Locks and ReentrantLock in Java, so I thought to write a simple Java program, which is multi-threaded and uses a rather new Lock interface and ReentrantLock to lock critical section. Remember Lock is your tool to guard shared resources which can be anything like a database, File system, a Prime number Generator, or a Message processor. Before using Locks in the Java program, it’s also better to learn some basics. Lock is an interface from java.util.concurrent package. It was introduced in JDK 1.5 release as an alternative to the synchronized keyword.

Top 5 Courses to learn Oracle and PL/SQL in 2021 - Best of Lot

Hello folks, f you have been thinking of learning Oracle and PL/SQL in 2021 and looking for the best online resources like books, courses, and tutorials, then you have come to the right place. Earlier, I shared the best Oracle books and free courses to learn Oracle Database, and in this article, I will share the 5 best online training courses to learn Oracle database and PL/SQL. These are the courses from sites like Udemy and Pluralsight and created by expert trainers and DBAs who have in-depth knowledge of Oracle and PL/SQL, and you can use them to learn Oracle from scratch or level up your Oracle and PL/SQL Skills. 

7 Free DataCamp Courses for Beginners to Learn Data Skills in 2021 - Best of Lot

Hello guys, if you are looking for free Datacamp courses to learn in-demand tech and data skills like Python, SQL, Data Science, Tableau, Data Analysis, etc then you have come to the right place. Earlier, I have shared, best DataCamp courses for Beginners and in this article, I am going to share the best free Datacamp courses to learn Python, SQL, and Data skills. If you don't know, Datacamp is one of the most popular websites for learning Data skills. Their interactive and hands-on courses make learning really easy and that's why both beginners and intermediate data scientists join Datacamp. 

Top 5 Node.js and Express JS online courses for Web Developers - Best of Lot

There is no doubt that JavaScript is the #1 Programming language in the world and Node.js is one of the biggest reasons for that. Initially, JavaScript was considered just a client-side scripting language but Node.js has changed all that by allowing developers to create dynamic web pages on the server-side using JavaScript. It is also rated as the most popular framework on the StackOverflow Developers survey. The most important benefit of Node.js is that it allows you to build a full-stack application based on just one language, JavaScript. This is especially useful for start-ups that put a lot of emphasis on being able to iterate early and often.

5 Reasons Why Java's old Date and Calendar API was Bad

If you have been programming in Java for a couple of years then you may know that how bad was Java's Date and Calendar API was, I mean the java.util.Date and java.utill.Calendar was badly designed. Though Java has corrected it's a mistake by introducing a brand new, shiny Date and Time API, not many Java developers are using it yet. In a bit to motivate you to use new Date and Time API from Java 8, I am going to list down a couple of reasons why Java's Date and Calendar class has been criticized so much in the past.  These points are also important to know from the Interview point of view because as an experienced Java programmer, it is expected from you to know the shortcomings of the existing API and how new API solves those problems.

How to solve FizzBuzz Problem in Java 8? Example

FizzBuzz is one of the most famous programming questions from interviews, which is generally used to weed out programmers who can't program. The problem is deceptively simple but you can't solve it if you don't know how to build programming logic. I love it just for its simplicity. Now coming back to the second part of this article, Java 8. It's been more than a year, I think it was March 18 last year when Java 8 was first released and to date, the most common question I have got is, how to learn new features of Java 8? like Optional, lambda expression, or Stream. I think the best way to learn Java 8 new features is the same as the best way to learn any new programming language like solving common coding problems, implementing data structure, common algorithms, and implementing famous design patterns.

Top 10 Courses to Learn Ruby on Rails for Beginners Online in 2021 - Best of Lot

Hello guys, If you want to learn Ruby Programming language or Ruby on Rails, a leading web development framework, then you have come to the right place. Earlier, I shared the best Python 3 courses and books, and today, I will share the best Ruby and Rails course for beginners. Ruby is one of the most popular web development programming languages, much like Python, PHP, and Java, and is used heavily for web development. Many startups and big organizations like Twitter use Ruby to build their website, and that's why there is a huge demand for Ruby developers. 

5 Free Courses to Learn OpenCV and Computer Vision Online in 2021 - Best of Lot

Hello guys, if you want to learn about OpenCV and Computer Vision in 2021 and are looking for free OpenCV and ComputerVision courses, you have come to the right place. Earlier, I shared the best OpenCV courses, which you love, but some of you also asked to share free OpenCV and Computer Vision, which I'll be doing today. In this article, I will share 5 free online courses to learn Computer Vision and Open CV in 2021. These courses are created by OpenCV experts and trusted by thousands of developers on platforms like Udemy, Coursera, and Pluralsight. You can also join them to kick start your career in Computer Vision and the OpenCV field.

Top 25 Recursion Interview Questions for Coding Interviews

Recursion is often dreaded by programmers as its very difficult for many programmers to visualize and understand, but it's a useful problem solving technique which often result in better, simpler and more concise code than their iterative solutions. That begin said, it's often difficult to come up when to use recursion to solve a coding problem. In general, you should use recursion if a problem can be broken down into sub-problems which are exactly the same as original problem. For example, finding a node in a binary tree.

Top 25 Vue.js Interview Questions and Answers for 1 to 2 Years Experienced

Hello guys, if you are preparing for Vue.js interviews and looking for some frequently asked Vue.js questions from interviews then you have come to the correct place. Earlier, I have shared React.js Interview questions and JavaScript questions and in this article, I am going to share common Vue.js Interview questions for 1 to 2 years experienced web developers. With the success of libraries like React.js, developers around the globe are leaning more towards such flexible technologies. Though full-fledged frameworks like Angular are also popular and widely used, developers want flexibility.

How to Clone a Collection in Java? Deep copy of ArrayList and HashSet Example

Programmers often mistook copy constructors provided by various collection classes, as a means to clone Collection like List, Set, ArrayList, HashSet, or any other implementation. What is worth remembering is that the copy constructor of Collection in Java only provides a shallow copy and not a deep copy, which means objects stored in both original Lists and cloned List will be the same and point to the same memory location in the Java heap. One thing, which adds to this misconception is a shallow copy of Collections with Immutable Objects. Since Immutable objects can't be changed, It's Ok even if two collections are pointing to the same object. This is exactly the case of String contained in the pool, update on one will not affect the other.

How to use Stream with List and Collection in Java 8? filter + map Example Tutorial

Finally, Java 8 is here, after more than 2 years of JDK 7, we have a much expected Java 8 with lots of interesting features. Though Lambda expression is the most talked-about item of the coming Java 8 release, it wouldn't have been this much popular, if Collections were not improved and Stream API was not introduced. Java 8 is bringing on new Streams API package, which allows you to process elements of Java Collections in parallel. Java is inheritably sequential and there are no direct means to introduce parallel processing at the library level, stream API is going to fill that gap. By using Stream API in Java, you can filter elements of collection on a given criterion. For example,  if you have a list of orders, you can filter buy orders with sell orders, filter orders based upon their quantity and price, and so on.

How to fix java.lang.ClassNotFoundException: [Solution]

This error comes when you try to connect to the Microsoft SQL Server database from the Java program but the required JDBC driver is not available in Classpath or driver is available in CLASSPATH but the class loader is not able to find it due to classpath intricacies. Depending upon your situation, a solution could be as simple as downloading any of sqljdbc.jar, sqljdbc4.jar, or sqljdbc41.jar, based upon the Java version you are using and adding them into CLASSPATH as set CLASSPATH = %CLASSPATH%; (path to Microsoft JDBC driver) in Windows. BTW, in most of the cases "java.lang.ClassNotFoundException:" comes because of classpath intricacies.

How to print 1 to 100 without using loop in Java? Example Solution

This is one of the interesting problems  I have seen in coding interviews for beginners. The program has a surprise element by saying that you need to print 1 to 100 without using a loop e.g. for, forEach, or enhanced for loop. This brings out some innovative solutions from candidates which tell a lot about their approach, knowledge, and attitude. I remember, asking this question during campus recruitment to at least 5 candidates. The first one took 5 minutes to think and then come up with the brute force way where he just copies pasted 100 System.out.println() and printed numbers 1 to 100 but when we asked to improve that, he couldn't do that. Unfortunately, he didn't think that recursion can replace an iterative algorithm without using a loop.

How to use SynchronousQueue in Java? Prouder Consumer Example

SynchronousQueue is a special kind of BlockingQueue in which each inserts operation must wait for a corresponding remove operation by another thread and vice versa. When you call to put() method on SynchronousQueue it blocks until another thread is there to take that element out of the Queue. Similarly, if a thread tries to remove an element and no element is currently present, that thread is blocked until another thread puts an element into the queue. You can correlate SynchronousQueue with athletes (threads) running with Olympic torch, they run with a torch (object need to be passed) and passes it to other athlete waiting at another end.

Top 10 Microservices Design Patterns and Principles - Examples

Hello guys, if you are using Microservice architecture and want to learn about different Microservice design patterns and principles to better architect your application then you have come to the right place. Earlier, I have shared the best Java Microservices courses and books for Java developers, and in this article, I am going to share the essential Microservice design principle and patterns. We will cover patterns like Event Sourcing, Circuit Breaker, SAGA, CQRS, Strangle, and API Gateway and principles like Scailibity, Flexibility, Resiliency, etc. 

Top 5 Online Courses to Learn React Native for Beginners in 2021 - Best of Lot

If you are a web developer who wants to go into the massive world of mobile app development but don't want to spend time learning Java or Kotlin for Android development or Objective C or Swift for iOS development, React Native could be an excellent tool for you. React Native is an extension of React, a popular JavaScript framework to develop web applications, which allows you to build native Android and iOS applications in JavaScript. Unlike Ionic and Cordova, which promotes write once run everywhere but doesn't offer you to create a native app, React Native does convert your code into native code, especially for GUI.

How to Convert an Array to Comma Separated String in Java - Example Tutorial

The simplest way to convert an array to comma separated String is to create a StringBuilder, iterate through the array, and add each element of the array into StringBuilder after appending the comma. You just need Java 1.5 for that, even if you are not running on Java 5, you can use StringBuffer in place of StringBuilder. The joining of String has got even easier in JDK 8, where you have got the join() method right in the String class itself. The join() method takes a delimiter and a source, which can be an array or collection, and returns a String where each element is joined by a delimiter.

Top 5 Online Courses to Learn Hadoop and Big Data in 2021 - Best of Lot

If you are learning Big Data and want to explore the Hadoop framework and looking for some excellent courses, then you have come to the right place. In this article, I am going to share some of the best Hadoop courses to learn Hadoop in depth. In the last couple of articles, I have shared some Big Data and Apache Spark resources, which are well received by my readers. After that, a couple of my readers emailed me and asked about some Hadoop resources, like books, tutorials, and courses, which they can use to learn Hadoop better. This is the first article in the series on Hadoop; I am going to share a lot more about Hadoop and some excellent resources in the coming month, like books and tutorials.

Java 8 - Stream FlatMap Example - List of Lists to List

The flatmap is an interesting concept of functional programming which allows you to flatten the list or stream apart from transforming it, just like the map does. This means you can use the flatmap to flatten the stream. If you have used the map() function from the Stream class before then you can use it to convert an object of type T to another object of Type S. For example, if you have a list of Authors then you can convert it to a List of books by transforming authors to books. FlatMap extends this idea, it not only transform one object to other it also flattens the list and that's it's very useful where you want to know about a combined data set. 

What is Double Brace Initialization in Java? Initializing HashMap and List with Values Example

Double brace initialization is a Java idiom to initialize a Collection like a list, set, and map at the time of declaration. At times, you need a list of fixed elements e.g. supported products, supported currencies, or some other config, and on-the-spot initialization reduces the line of code and improves readability. Double brace initialization idiom becomes popular because there is no standard way to create and initialize Collection at the same time in Java. Unfortunately, unlike other JVM languages like Scala and Groovy, Java doesn't support collection literals yet. 

Overriding equals() and hashCode() method in Java and Hibernate

Override equals and hashCode in Java
Equals and hashCode in Java are two fundamental methods that are declared in Object class and part of the core Java library. equals() method is used to compare Objects for equality while hashCode is used to generate an integer code corresponding to that object. equals and hashCode have been used extensively in Java core library like they are used while inserting and retrieving Object in HashMap, see how to get method of HashMap works in Java for the full story, equals method is also used to avoid duplicates on HashSet and other Set implementation and every other place where you need to compare Objects.

What is String deduplication in Java? How to Save Memory from Duplicate String in Java 8? [Answer]

You might not be aware that Java 8 update 20 has introduced a new feature called "String deduplication" which can be used to save memory from duplicate String objects in Java application, which can improve the performance of your Java application and prevent java.lang.OutOfMemoryError if your application makes heavy use of String. If you have profiled a Java application to check which object is taking the bulk of memory, you will often find char[] object at the top of the list, which is nothing but an internal character array used by String object. Some of the tools and profilers might show this as java.lang.String[] as well like Java Flight Recorder, but they are essentially pointing to the same problem i.e. a major portion of memory is occupied with String objects.

How to return different HTTP status code from a Spring MVC controller? Example Tutorial

Hello guys, if you are wondering how to return different HTTP Status codes from a Spring MVC controller then you have come to the right place. You can use @ResponseCode annotation on Spring MVC to send different HTTP codes to the client as part of the HTTP response. If you are developing REST APIs then you can even @RestControler to do that job. This article will demonstrate how to return different HTTP statuses for a Spring MVC controller. Prior to implementation, all we need to understand what is with the HTTP return types and why we need them. Let's have a quick look into this.

5 Differences between COALESCE and ISNULL in SQL Server - Example Tutorial

Even though both ISNULL and COALESCE is used to provide default values for NULLs there are some key differences between them like ISNULL() is a T-SQL or Microsoft SQL Server-specific function or operator, and datatype and length of the result depends upon a parameter, but COALESCE is a SQL ANSI standard, it can accept more than one parameter and unlike ISNULL, the result doesn't directly depend upon a parameter, it is always the type and length of the value returned. Also, what is the difference between COALESCE and ISNULL is one of the frequently asked Microsoft SQL Server interview questions, and knowing these differences can help in both your day-to-day SQL development works and during job interviews.

Difference between map() and flatMap() in Java 8 Stream - Example

The map() and flatmap() are two important operations in the new functional Java 8. Both represent functional operation and they are also methods in class but the map is used for transformation and flatmap is used for both transformation and flattening, that's why it's called the flatmap. The key difference between map() and flatmap() function is that when you use a map(), it applies a function on each element of the stream and stores the value returned by the function into a new Stream. This way one stream is transformed into another like a Stream of String is transformed into a Stream of Integer where each element is the length of the corresponding Stream.

Top 5 Courses to Crack AWS Solutions Architect - Associate Exam (SAA-C01 and C02) in 2021 - Best of Lot

Hello guys, are you preparing for AWS Solutions Architect - Associate Exam?  or Do you want to become Amazon Web Services (AWS) Certified Developer to give your Cloud Computing career a push? and looking for some useful resources to prepare well for your exam then you have come to the right place. In the past, I have shared some free courses to learn AWS for beginner and in this article, I will share some of the best online courses to pass the AWS Solutions Architect - Associate Exam and become Amazon Web Services Certified Associate - a certification which will not only add value into your resume but also help you to get the high-paying job you always wanted.

How to use props in React? Example Tutorial

If you have ever worked with React, you definitely know what components are. A react application is made of several components and that is why components in React are defined as the building blocks of the application. In simple terms, a component is a class or function that can accept input and return a piece of code that defines a UI. Every React component can have input. These inputs are known as props. Props stand for properties and they are optional. A component works fine without props but they are one of the most useful parts of React.

3 Best Spring Security Online Training Courses for Java Developers in 2021 [UPDATED]

Spring Security is one of the leading open-source, security frameworks that allow you to implement security in Java-based web applications. It provides several security features like authentication, authorization, remember me out-of-the-box, which means you can directly use them without adding code or changing your class. Yes, Spring Security implements security at the application level i.e. you can even secure your non-secure resource without modifying them. It is also the leading framework to secure RESTful Web Services. Because of all these, the demand for Java developers with good knowledge of Spring Security is very high.

10 Example of Lambda Expressions and Streams in Java 8

Java 8 release is just a couple of weeks away, scheduled on 18th March 2014, and there is a lot of buzz and excitement about this path-breaking release in the Java community. One feature, which is synonymous with this release is lambda expressions, which will provide the ability to pass behaviors to methods. Prior to Java 8, if you want to pass behavior to a method, then your only option was the Anonymous class, which will take 6 lines of code, and the most important line, which defines the behavior is lost in between. Lambda expression replaces anonymous classes and removes all boilerplate, enabling you to write code in a functional style, which is sometimes more readable and expression.

Top 30 React.js Interview Questions Answers for 1 to 2 Years Experienced

Hello guys, if you are preparing for React developer interviews and looking for frequently asked React.js interview questions then you have come to the right place. Earlier, I have shared the best courses, books, and websites to learn React.js and in this article, I am going to share 35 frequently asked React.js interview questions, suitable for 1 to 2 years experience developers. ReactJS is one of the most recently built open-source front-end programming languages. It came directly from Facebook's headquarter back in 2011. Earlier Recat.js was only limited to Facebook but now, it is one of the most extensively used programming languages all across the world.

What is volatile modifier or volatile field in Java? Example

The volatile modifier has always been an interesting and tricky topic for many Java programmers. I still feel that it's one of the most underutilized modifiers in Java, which can do a lot of good if understood and applied correctly, after all, it provides a lock-free way to achieve synchronization in Java. If a field is shared between multiple threads and one of them changes its value i.e. one thread reads from the field which is written by other threads, then, by using a volatile modifier, you can synchronize access to this field. The volatile modifier in Java provides visibility and ordering guarantees without any locking.

5 Difference between Constructor and Static Factory method Pattern in Java

The common way to create objects in Java is by using public constructors. A class provides a public constructor like java.lang.String so anyone can create an instance of String class to use in their application, but, there is another technique that can be used to create objects in Java and every experienced Java programmer should know about it. A class can provide a public static factory method that can return an instance of the class e.g. HashMap.newInstance(). The factory method is a smart way to create objects in Java and provides several advantages over the traditional approach of creating objects using constructors in Java. It can also improve the quality of code by making the code more readable, less coupled, and improves performance by caching.

How to set Java Path and Classpath in Windows 7, 8 and Windows 10 - Tutorial

So, you just bought a new PC or Laptop with Windows 8 operating system, and wondering how to set PATH and Classpath on Windows 8; Or, you might have just upgraded your Windows 7 laptop to the professional edition of Windows 8 and looking to set JDK Path to compile Java programs. Not to worry, this is the second step for anyone who wants to learn Java programming. Of course, the first step is to install JDK.  In this Java tutorial, we will see step by step guide to set Java PATH and CLASSPATH in the Windows 8 operating system. By the way, if you are learning Java in Windows 10 operating system, You should still be able to set the Java path and classpath in Windows 10 by following the steps given here, because navigation steps for modifying environment variables on Windows 10 and Windows 8 are almost same.

Difference between @WebMvcTest and @DataJpaTest in Spring Boot? Example

Hello guys, testing the Spring Boot application is very important but not many developers pay attention to that. If you are learning how to test the Spring Boot application and wondering what is @WebMvcTest and @DataJpaTest and how to use them then you have come to the right place. Earlier, I have shared 20+ Spring Boot Testing interview questions and in this article, I will teach you how to use @DataJpaTest and @WebMvcTest annotation with real-world examples.  Spring Boot is an evolution of the Spring framework which helps to create both stand-alone and spring-based applications with minimal cost. 

Top 6 Online Courses to learn Gatsby.js Framework in 2021 - Best of Lot

Hello guys, if you want to learn Gatsby and looking for the best online courses to learn Gatsby, then you have come to the right place. In the past, I have shared the best React courses, and today, I will share the best Gatsby online courses for beginners. The Gatsby.js has become significantly popular in recent years. It is a react-based static site generator powered by GraphQL and is quite popular to develop static websites that don't require a traditional backend. Instead, these site uses APIs and CDN to deliver content to browser and mobile applications. 

How to remove all special characters from String in Java? Example Tutorial

You can use a regular expression and replaceAll() method of java.lang.String class to remove all special characters from String. A special character is nothing but characters like - ! #, %, etc. Precisely, you need to define what is a special character for you. Once you define that you can use a regular expression to replace those characters with empty String, which is equivalent to removing all special characters from String. For example, suppose, your String contains some special characters e.g. "Awesome!!!" and you want to remove those !!! to reduce some excitement, you can use replaceAll("!", "") to get rid of all exclamation marks from String.

Difference between Comparison (QuickSort) and Non-Comparison (Counting Sort) based Sorting Algorithms? Example

For many of you, this might be a surprise that how you can sort or arrange items without comparing them with each other, but it's possible. There are some sorting algorithms that perform sorting without comparing the elements rather than making certain assumptions about the data they are going to sort. The process is known as non-comparison sorting and algorithms are known as the non-comparison-based sorting algorithms. Non-comparison sorting algorithms include Counting sort which sorts using key-value, Radix sort, which examines individual bits of keys, and Bucket Sort which examines bits of keys. These are also known as Liner sorting algorithms because they sort in O(n) time. They make certain assumptions about data hence they don't need to go through a comparison decision tree.

Why Static Code Analysis is Important? Pros and Cons

In the last few years, Software code quality and security have gone from being a “nice to have” to a necessity, and many organizations, including investment banks, are making it mandatory to pass static code analysis tests, penetration testing, and security testing before you deploy your code in production. Static analysis tools like findbugs and fortify are getting popular every passing day and more and more companies are making fortify scan mandatory for all new development.  For those unaware of what static code analysis is, static code analysis is about analyzing your source code without executing them to find potential vulnerabilities, bugs, and security threats.

Single Responsibility Principle Example - SRP of SOLID Design Principle Tutorial

Hello guys, if you want to learn about SRP or the Single Responsibility principle and wondering how to write code that follows SRP and what are pros and cons of following this design principle then you have come to the right place. Earlier, I have shared the best object-oriented programming and design courses and books and in this article, I am going to talk about SPR. The Single Responsibility Principles, popularly known as SRP is part of 5 Object-oriented design principles, introduced by Robert C. Martin, popularly known as Uncle Bob. The Single Responsibility principle says that "there should be one reason to change a class". This means a class should do only one thing, and do it perfectly.

Top 5 Courses to Crack Certified Kubernetes Application Developer (CKAD) Exam in 2021 - Best of Lot

Hello guys, if you are preparing for Kuberfnetes Application developer certification or want to become a Certified Kubernetes Application developer (CKAD) and looking for the best online courses to prepare for this certification, then you have come to the right place. Earlier, I have shared the best courses to learn KubernetesDocker, and CKA courses. Today, I will share the best online courses to crack the Kubernetes Developer certification, also known as the CKAD. These are the best and most affordable online courses from Udemy, Pluralsight, and Whizlabs and help you prepare for crucial exam topics tested during the certification exam. Remember this is a hands-on exam, and you need solid experience and knowledge to pass this Kubernetes Developer certification.

17 Examples of Calendar and Date in Java - Tutorial

The java.util.Calendar class was added in Java on JDK 1.4 in an attempt to fix some flaws of the java.util.Date class. It did make some tasks simpler, e.g. create an arbitrary date comes easier using the new GregorianCalendar(2016, Calendar.JUNE, 11) constructor, as opposed to the Date class where the year starts from 1900 and the Month was starting from zero. It didn't solve all the problems e.g. mutability and thread-safety of Date class still remains, but it does make life easier at that time. Now with Java 8 everything related to Date and Time has become super easy and consistent but unfortunately, it will take another 5 to 10 years before the older version of Java goes away. Don't believe me, there are still applications running on JDK 1.5 which was released 12 years ago. The bottom line is it's still important to know about the Date and Calendar in Java.

How to Read/Write from RandomAccessFile in Java - Example Tutorial

Random access file is a special kind of file in Java that allows non-sequential or random access to any location in the file. This means you don't need to start from 1st line if you want to read line number 10, you can directly go to line 10 and read. It's similar to the array data structure, Just like you can access any element in the array by index you can read any content from the file by using a file pointer. A random-access file actually behaves like a large array of bytes stored in the file system and that's why it's very useful for low latency applications which need some kind of persistence e.g. in front office trading application and FIX Engine, you can use random access file to store FIX sequence numbers or all open orders.

Java 8 Comparator comparing() and thenComparing() Example - Tutorial

Hello Java programmers, you may know that the JDK 8 has added a lot of new methods into the Comparator interface which makes comparing and sorting objects in Java really easy. Two such methods are called comparing() and thenComparing() which was added in the java.util.Comparator interface. These methods accept a key extractor function and return a Comparator that can compare to that key. The key must be Comparable though like String, Integer, or any Java class which implements java.lang.Comparable interface, I mean the key must implement Comparable interface. 

Difference between JAX-RS, Restlet, Jersey, RESTEasy, and Apache CXF Frameworks

The JAX-RS is a Java specification request (JSR 311 & JSR 339) that standardizes the development and deployment of RESTful web services using Java and JEE technologies. It provides API in Java Programming language to create web services according to the REST (Representational State Transfer) architectural pattern. Both Restlet and Jersey are two of the most popular implementation of JAX-RS used for developing RESTful web services in Java ecosystem but there is a couple of other implementation also exist like Apache Wink, Apache CXF, and JBoss RESTEasy, along with omnipresent and the most popular option of creating REST web services with Spring Framework, Spring Boot, and Spring MVC

Top 5 Courses to learn WordPress for Beginners in 2021 - Best of Lot

Hello guys, if you want to learn WordPress to create online websites and start your career in web design and website development, you have come to the right place. In the past, I have shared the best courses to learn HTMLCSSJavaScriptBootstrap, and Web development, and today I will share about the best online training courses to learn WordPress. WordPress is one of the easiest ways to create a website. It's also one of the most essential tools for web designers and web developers. If you know WordPress, you can work on different kinds of companies like startups and even multi-national. WordPress also allows you to do a lot of freelancing work.

What are React and Redux Hooks? Example Tutorial

Hello guys, if you want to learn about Hooks in React.js like useState, useSelector, useEffect, and useDispatch then you have come to the right place. In the past, I have shared the best React courseswebsites, and books and in this article, I am going to show you what is React hooks and how they make coding and statement management easier in React.js. If you remember, React came out in 2013 and since then, it has become one of the biggest players in the front-end development community. Today, React's demand is more than any other framework or library. There are several reasons for its popularity. React is flexible, easy to learn, programmer-friendly, and most importantly, it's high performing. 

How to compare objects on natural order in Java? Comparable + compareTo Example

Java allows you to sort your object in natural order by implementing a Comparable interface. It's one of the fundamental interfaces of Java API and is defined in java.lang package, which means you don't need to implement this unlike its counterpart Comparator, which is defined in java.util package.  Comparable is used to provide natural order of sorting to objects e.g. numeric order is a natural order for numbers, alphabetic order is a natural order for String and chronological order is natural for dates. Similarly when you define your own objects like Person, Book, or Employee, sorting them by name sounds natural. Similarly, for teams, ranking seems their natural order. It all depends on how the object is looked into in its domain.

Top 10 Pluralsight Courses for React Developers - Best of Lot

Hello guys, if you are looking for the best React courses on Pluralsight, then you have come to the right place. Earlier, I have shared the best Pluralsight methods for Java developers, and today, I will share the best courses to learn React.js, one of the most in-demand skills for both Java and Fullstack developers. Pluralsight is one of my favorite learning websites because you can learn from subject matter experts and their courses are also well designed. They don't have giant classes of 50 hours, plus they have multiple courses where you can learn valuable skills in a couple of hours. That's what I like most because I never have that much time. 

Difference between Association, Composition and Aggregation in Java, UML and Object Oriented Programming

In Object-oriented programming, one object is related to another to use functionality and service provided by that object. This relationship between two objects is known as the association in object-oriented general software design and is depicted by an arrow in Unified Modelling Language or UML. Both Composition and Aggregation are the forms of association between two objects, but there is a subtle difference between composition and aggregation, which is also reflected by their UML notation. We refer to the association between two objects as Composition when one class owns other classes and other classes can not meaningfully exist, when the owner is destroyed.

Review - Introduction to Machine Learning Specialization by IBM on Coursera

Hello folks, if you are interested in Machine learning and looking for the best Machine learning course online, then you have come to the right place. Earlier, I have shared the best Machine Learning and Data Science courses, and in this article, I will review IBM's popular Introduction to Machine Learning Specialization in Coursera. IBM doesn't need an introduction, and this is a great course for anyone who wants to learn about Machine Learning, its importance, and its impact.  This course is carefully built by IBM's Machine Learning experts to teach you Machine learning through real-life examples and use cases; that's also one thing that makes it different from other courses. 

How to Filter Stream and Collections in Java 8? Example Tutorial

Java 8 provides excellent features to support the filtering of elements in Java Collections. Prior to Java 8, the only better way to filter elements is by using a foreach loop or iterating over Collection using the Iterator and selecting the required object, leaving out rest. Though that approach work, it was very difficult to run them in parallel and take advantage of multiple CPUs available in modern-day servers. Java 8 provides Streams, which not only makes it easy to run any operation parallel but also supports lazy loading and lazy evaluation, which means as soon as the filtering condition is satisfied, it stooped doing work, doesn't matter how many objects the collection contains.

How to use useDispatch and useSelector? React Hooks Example Tutorial

Hello guys, if you are learning about React hooks and wondering how to use useDispatch and useSelector hooks in React application then you have come to the right place. Earlier,, I have shared the best React courseswebsites, and books and in this article, I am going to show you how React hooks make coding and statement management easier than it was before. The introduction of React hooks changed a lot in the react application development. Developers moved from complicated and length class-based components to simpler functional components that can do the same work in fewer lines of code. 

Top 5 Google Cloud Professional Architect Certification Courses & Practice Tests in 2021 [UPDATED]

Hello guys, if you are preparing for Google Cloud Architect Certification and looking for the best GCP Cloud Architect course, then you have come to the right place. I have shared about the GCP Cloud Engineer and Data Engineer Certification in the past, and today, I will share the best online courses for the GCP Cloud Architect Certification exam. If you want to enrich your CV or work with Google cloud platforms, but you're unable to decide which course is the right fit for you, then check out these great options. The list contains the best online training courses for the Google Cloud Certified Professional Cloud Architect exam from Udemy, Coursera, Whizlabs, and Pluralsight.

How HashMap works in Java

HashMap in Java works on hashing principles. It is a data structure that allows us to store object and retrieve it in constant time O(1) provided we know the key. In hashing, hash functions are used to link keys and values in HashMap. Objects are stored by the calling put(key, value) method of HashMap and retrieved by calling the get(key) method. When we call the put method, the hashcode() method of the key object is called so that the hash function of the map can find a bucket location to store the value object, which is actually an index of the internal array, known as the table.
HashMap internally stores mapping in the form of Map.Entry object which contains both key and value object.

Top 5 modern JavaScript features you should learn in 2021

Hello guys, if you are wondering what to learn in JavaScript to take your skills to the next level, then you have come to the right place. Earlier, I have shared the best Javascript courses and books. In this article, I will share essential modern Javascript features like arrow functions, let and const keywords, restructuring, spread operator, etc., to learn in 2021. JavaScript is the most popular and widely used programming language in the world. Over 90% of the websites use JavaScript in one way or other. 

StringTokenizer Example in Java with Multiple Delimiters - Example Tutorial

StringTokenizer is a legacy class for splitting strings into tokens. In order to break String into tokens, you need to create a StringTokenizer object and provide a delimiter for splitting strings into tokens. You can pass multiple delimiters e.g. you can break String into tokens by, and: at the same time. If you don't provide any delimiter then by default it will use white-space. It's inferior to split() as it doesn't support regular expression, also it is not very efficient. Since it’s an obsolete class, don't expect any performance improvement either. On the hand split() has gone some major performance boost on Java 7, see here to learn more about splitting String with regular expression.

The 2021 Frontend and Backend Developer RoadMap [UPDATED]

Hello Guys, if one of your goals is to learn to code or to become a Web Developer in 2021, then I have something significant to share with you, the Complete Web Developer RoadMap. This is an excellent illustration of how to become a web developer in 2021 and guide you on how you can learn and master Web Development in 2021. It's a collection of different paths to learning front-end, back-end, and all other things a Web developer should know.  You will not just know about web development but about essential programming stuff which is necessary for all kinds of programmers.

5 ways to check if String is empty in Java - examples

String in Java is considered empty if it's not null and its length is zero. By the way, before checking length you should verify that String is not null because calling length() method on null String will result in java.lang.NullPointerException. Empty String is represented by String literal “”. The definition of empty String may be extended to those String as well which only contains white space but it's a specific requirement and in general String with white space is not considered as empty String in Java. Since String is one of the most frequently used classes and commonly used in method arguments, we often need to check if String is empty or not. Thankfully there are multiple ways to find if String is empty in Java or not.

Spring Data JPA @Query Example - Tutorial

Hello guys, if you are learning Spring Data JPA or using Spring Data JPA in your project and are not sure how to use @Query annotation then you have come to the right place. Earlier, I have shared the best Spring Data JPA courses and Spring Data JPA Interview questions and in this article, I am going to show you how to use @Query annotation from Spring Data JPA to create dynamic SQL queries. Spring is a popular Java application framework for creating enterprise applications and Spring Boot is an evolution of the Spring framework which helps to create standalone applications in a minimal effort. 

Difference between for loop and Enhanced for loop in Java? Example Tutorial

Though you can use both for loop and enhanced for loop to iterate over arrays and collections like a list, set, or map. There are some key differences between them. In general, enhanced for loop is much easier to use and less error-prone than for loop, where you need to manage the steps manually. At the same time, for loop is much more powerful because you get the opportunity to control the looping process. All the differences, you will learn in this article, stems from the very fact that traditional for loop gives more control than enhanced for loop but on the other hand enhanced or advanced for loop gives more convenience.

Top 5 Online Courses to Learn Puppet for DevOps in 2021 - Best of Lot

Hello guys, If you are interested in DevOps, you might have heard about Puppet, one of the most popular infrastructure automation tools. If you want to learn Puppet and looking for the best Puppet courses, then you have come to both the right places. Earlier, I have shared the best DevOps courses, and today, I am going to share the 5 best Puppet courses you can join to learn this useful DevOps tool. It is no surprise that automation and orchestration make life very easy, be it a small organization or a large-scale industry that houses hundreds of servers. Puppet plays an important role in infrastructure automation, such as creating and configuring application servers.

How to Convert Binary Number to Decimal in Java - Algorithm Example Tutorial

Problem: Write a Java program to convert a binary number into the decimal format, without using any library method which can directly solve the problem. You are free to use basic Java functions through e.g. those defined in java.lang and all kinds of Java operators e.g. arithmetic and logical operator, bitwise and bitshift operator, and relational operators.

Solution: Let's first revise some theory of the number system, which is required to convert a number from binary to decimal format. There are four kinds of number systems binary, octal, decimal, and hexadecimal. Binary is base 2 and that's why any number is represented using only two-digit, 0, and 1 also known as bits.

How to use Future and FutureTask in Java Concurrency with Example

Future and FutureTask in Java allows you to write asynchronous code. The Future is a general concurrency abstraction, also known as a promise, which promises to return a result in the future. In asynchronous programming, the main thread doesn't wait for any task to be finished, rather it hands over the task to workers and moves on. One way of asynchronous processing is by using callback methods. The Future class in Java is another way to write asynchronous code.

What is difference between Maven, ANT, Jenkins and Hudson?

In short, though Maven and ANT are build tools the main difference is that maven also provides dependency management, standard project layout, and project management. On the difference between Maven, ANT, and Jenkins, later is a continuous integration tool which is much more than a build tool. You can set up your CI environment using Jenkins or Hudson and automatically build, test, and deploy your Java project. Now last, the main difference between Jenkins and Hudson, both originate from the same source code but one is a closed source while the other is open source. You can read the details in this article.

Difference between OCPJP 8 Upgrade Exams 1Z0-813 and 1Z0-810? Which one to take?

Many Java developers who hold a Java certification either from Sun or Oracle and who are looking to upgrade to the latest Java version i.e. Java SE 8 certification have a common doubt, should they go for 1Z0-810 or 1Z0-813 upgrade exams? What are the differences between these two exams? Well, even though they are both upgrades to Java SE 8 exams, they are separate exams and have a different exam code, the difference is also obvious when you look at their title. The 1Z0-810 exam is known as "Upgrade Java SE 7 to Java SE 8 OCP Programme" while the 1Z0-813 exam is known as "Upgrade to Java SE 8 OCP ( Java SE 6 and all prior versions)".

7 Best Data Science Courses & Certifications on Coursera from Johns Hopkins University in 2021

Hello guys, if you are thinking to start a career in Data Science and Machine Learning and looking for the best resources then you have come to the right place. Earlier, I have shared the best Coursera courses to learn Software Development, Cloud Computing, and Web Development, and in this article, I am going to share the best online courses, and certifications from Johns Hopkins University to learn Data Science from scratch with both Python and R. John Hopkins University is one of the world-class universities based in Baltimore, Maryland. It was founded in 1876, and its also America's first research university and home to nine world-class academic divisions working together as one university. 

Top 5 Online Courses to become a Salesforce Developer in 2021 - Best of Lot

Hello folks, if you want to become a Salesforce developer and look for the best online training courses, you have come to the right place. Salesforce is customer relationship management used by companies to organize their works and keep the workflow up. Still, it is also a vast platform developer can use to create apps, develop them, customize them, and deploy them on a server. Salesforce has launched many certification programs for these purposes that allow you to learn how this platform works and how to use it, such as the Salesforce Platform App Builder and the Salesforce Administrator, and the Salesforce Development Training, which is required to become a Salesforce developer.

5 Free OCEJWCD 6 Mock Exam 1Z0-899 Practice Test

The OCEJWCD is Oracle's version of the SCWCD (Sun Certified Web Component Developer) exam, which tests the candidate's knowledge of Servlet, JSP, and other web technology. The OCEJWCD stands for Oracle Certified Enterprise Java Web Component Developer. Like other Java certifications like the OCAJP or OCPJP, the key to success is selecting a good book, practicing code daily, and then solving as many mock questions as possible.

How to create LocalDateTime in Java 8 - Example Tutorial

The LocalDateTime is a new class introduced in Java 8 new Date and Time API. This class is in java.time package and it represents both date and time information without timezone. In this example, you will learn different ways to create an instance of LocalDateTime class in Java 8 like by using the static factory method, or by combining LocalDate and LocalTime instances together, which are subsequently used to denote date without time and time without the date in Java 8. As their name suggests they are local, so they don't contain timezone information.

How to use state in react? Example Tutorial

Hello guys, I have just started a new series, React for Java developers and I am going to publish React tutorials and examples to teach React.js, one of the most popular frontend libraries to Java developers. Since most full-stack Java development is happening on React and Spring Boot, it makes sense for Java developers to learn React.js. In the past, I have also shared both best React courses and books, as well as The React Developer RoadMap, which provides all the tools, libraries, and resources you need to become a proficient React Developer. 

Top 5 UX/UI Design Courses & Certifications to Learn in 2021 - Best of Lot [UPDATED]

Hello guys, If you always wanted to learn UX design and become a UX designer and looking for the best UI/UX design online courses to start with, then you have come to the right place. In the past, I have shared the best web design courses and web development courses, and In this article, I will share the best UX online courses and certifications you can join to become a UX designer in 2021. The demand for UX/UI and Web Design professionals continues to increase in today's job market. Learning UI or UX skills can open doors to many jobs, both local and remote.  It goes without saying that certification in any discipline will give you a leg up on your job hunt.

3 ways to loop over Set or HashSet in Java? Examples

Since Set interface or HashSet class doesn't provide a get() method to retrieve elements, the only way to take out elements from a Set is to iterate over it by using the Iterator, or loop over Set using advanced for loop of Java 5. You can get the iterator by calling the iterator() method of the Set interface. This method returns an iterator over the elements in the sets but they are returned in no particular order, as Set doesn't guarantee any order. Though individual Set implementations e.g. LinkedHashSet or TreeSet can impose ordering and in such iterator will return elements on that order.

Java Comparator Example for Custom Sorting Employee by Name, Age and Salary

In this tutorial, we will see the Java Comparator example to sort an Employee object by name, age, and salary. In order to sort Employee object on different criteria, we need to create multiple comparators e.g. NameComparator, AgeComparator, and SalaryComparator, this is known as custom sorting in Java. This is different from the natural ordering of objects, provided by the compareTo() method of java.lang.Comparable interface. Though both compare() and compareTo() method looks similar they are different in the sense that, former accepts one parameter, while later accepts two-parameter. Former compare passed object to the current object, on the other hand, compare() method compares two different objects passed to it.

How to use Lambda Expression in Place of Anonymous Class in Java 8 - Example Tutorial

Before Java 8, the Anonymous class was the only way you can implement functional idioms in Java. Since prior to Java 8 you cannot pass a function to another function, you would have to wrap it into an object, as seen in Strategy Pattern. Those are also known as function objects in Java. Anonymous class was also handy to create a throw-away implementation of SAM (Single Abstract Methods) interfaces like RunnableCallable,  CommandListener, or ActionListener. Despite all these goodies and flexibility, the Anonymous class adds too much boilerplate code, making it hard to read and understand.

Top 6 Courses to learn GitLab CI/CD for Beginners in 2021 - Best of Lot

There are tons of tools in the DevOps world that address different phases of DevOps like create, package, deploy, secure, monitor, etc., but Gitlab does all of them, which is why GitLab is gaining a lot of Traction. Companies like Goldman Sachs, NVIDIA, SIEMENS are using GitLab to create an end-to-end DevOps platform. You can do source code management like Github, CI/CD like Jenkins and TeamCity, Configure infrastructure like Ansible and Puppet, and much more. If you are aiming to become a DevOps Engineer in 2021, then learning GitLab could be a game-changer as there are not many people with GitLab experience, and there is a great demand for IT professionals with GitLab skills. 

Reading/Writing to/from Files using FileChannel and ByteBuffer in Java - Example Tutorial

In the past, I have talked about RandomAccessFile and how it can be used for doing faster IO in Java, and in this Java NIO tutorial, we are going to see how to use read/write data from using FileChannel and ByteBuffer. Channel provides an alternate way to read data from a file, it provides better performance than InputStream or OutputStream. It can also be opened in blocking and non-blocking mode. Though FileChannles are read/write channels and they are always blocking, they cannot be put into non-blocking mode.

Python for Everybody Coursera Specialization Certification Review 2021

Hello guys, if you want to learn Python and looking for the best Python course on Coursera, or you are just wondering if the Python for Everybody course from the University of Michigan on Coursera is worth your time and money then you have come to the right place. Earlier, I have shared the best Coursera certifications for Python and  In this post, we will review Python for Everybody from the University of Michigan, the best Coursera specialization and certification for Python developers. If you are in a hurry and want a quick Yes/No answer whether you should join this Coursera specialization or not then our answer is Yes, by all means, you should go for it.

Difference between Functional and Non-Functional Requirements in Software development - Example

Gathering the correct and complete requirements is one of the most important things in software development. Incorrect and incomplete requirements are the main reasons why the project fails. If you are in software development, you may have come across terms like functional and non-functional requirements. If you are wondering why a prototype takes 2 weeks but actual application development requires around 3 to 4 months of development; think of non-functional requirement. When someone told you to build software, what they tell you is what that software should do like allow you to trade on a certain market, but they don't tell you about security, performance, load, and other stuff, this is what I called non-functional requirement. 

Coursera's Google IT Support Professional Certificate Review! - Is it worth in 2021?

Hello guys, if you are looking for a cost-effective and recognized IT training program to start your career in IT then you have come to the right place. In this article, we'll review Google IT Support Professional Certificate from Coursera which can be used to launch your career in IT support. If you are trying to get involved in the IT industry at an entry-level may because you need to be a programmer web developer, or even cisco certified so you have to learn the basics of information technology or maybe just for fun and learn how things work and educate yourself more about this amazing industry.

Top 5 Blogs Java EE developers should follow

One reason for Java's great success as a programming language is that it has dominated the Enterprise space. Earlier J2EE used to be the popular platform, but now we have a more modern and improved Java EE platform, with the latest release of Java EE 7. Java Platform, Enterprise Edition 7 provides new features that include enhanced HTML5 support, increases developer productivity, and further improves how enterprise demands can be met. One of the biggest advantages of Java EE 7 is the reduction of boilerplate code.

10 Difference between Primitive and Reference variable in Java - Example Tutorial

There are two types of variables in Java, primitive and reference type. All the basic types e.g. int, boolean, char, short, float, long and double are known as primitive types. JVM treats them differently than reference types, which is used to point objects e.g. String, Thread, File, and others. Reference variables are not pointers but a handle to the object which is created in heap memory. The main difference between primitive and reference type is that primitive type always has a value, it can never be null but reference type can be null, which denotes the absence of value. So if you create a primitive variable of type int and forget to initialize it then it's value would be 0, the default value of integral type in Java, but a reference variable by default has a null value, which means no reference is assigned to it.

Top 10 Free Courses to Learn Angular and React.js for Beginners in 2021 - Best of Lot

There is no doubt that both Angular and React (also known as Angular JS and React JS) are two of the most popular frameworks for modern web development, particularly front-end development. It was Angular who started the new way to develop a web application using JavaScript, but now React, and Vue.js are taking that to another level. I have seen more and more people are learning React in recent times. Btw, today's world is all about full-stack developers like you should know how to develop a web application end-to-end, starting from front-end to back-end, and that's why as a full-stack Java developer, you should React or Angular Framework.

Adapter vs Decorator vs Facade vs Proxy Design Pattern in Java

There is some striking similarity between Adapter, Decorator, Facade, and Proxy design patterns, in the sense that they all use Composition and delegation to solve the problem. The adapter pattern wraps an interface, and delegates call to it. The decorator wraps an object and implements behavior on top of that, Facade wraps one or more interfaces to provide a central interface, which is easy to use and Proxy Pattern also wraps Subject and delegates calls to it. Then questions come, why are different patterns? What is the difference between Adapter, Decorator, Facade, or Proxy pattern, if their structure is the same. The answer is Intent. Yes, all of these Java design patterns have similar structure and class diagrams but their intents are totally different from each other.

Difference between extends and implements keywords in Java? Example Tutorial

Though both extends and implements keyword in Java is used to implement Inheritance concept of Object-Oriented programming, there is a subtle difference between them. The extends keyword is mainly used to extend a class i.e. to create a subclass in Java, while the implements keyword is used to implement an interface in Java. The extends keyword can also be used by an interface for extending another interface. In order to better understand the difference between extends and implements, you also need to learn and understand the difference between class and interface in Java.

Why Default or No Argument Constructor is Important in Java Class? Answer

Almost all Java developers know that compiler adds a default constructor or better known as a no-argument constructor in every Java class, but many of them forget that it only does when you don't provide any other constructor. This means it becomes the developers' responsibility to add a no-argument constructor if he is adding an explicit constructor. Now, Why it's important to provide a default constructor in Java, What happens if your class doesn't have a no-argument constructor? Well, this is how it's asked in many Java interviews, most commonly as part of Spring and Hibernate interviews.

Difference between var, let, and const in JavaScript? Example Tutorial

Hello guys, if you want to understand the difference between var, let, and const in JavaScript then you have come to the right place. Earlier, I have shared the best books and JavaScript courses for beginners and in this article, I will tell you the difference between varlet, and const and when to use them. They are three different ways to declare variables in JavaScript. The var is the classic and old way to declare variables in Javascript and it can declare both local and global variables, while let and const are new ways to declare variables in Java and they have block scope, I mean they are only visible in the block they are declared. let is used to declare local variables while const is generally used to declare constants, I mean variable whose value doesn't change once initialized. 

3 Ways to Convert Java 8 Stream to an Array - Lambda Expression and Constructor Reference Example

One of the frequently asked Java 8 interview questions is, how you do convert a Java 8 Stream to an array? For example, you have a Stream of Strings and you want an array of String so that you can pass this to a legacy method that expects an array, how do you do that? Well, the obvious place to search is the Javadoc of class and there you will find a toArray() method. Though this method will convert the Stream to an array it has a problem, it returns an Object array. What will you do, if you need a String array? Well, you can use the overloaded version of the toArray(IntFunction generator), which expects a generator function to create an array of the specified type.