How HashSet works in Java [Explained]

Not many Java programmers know that HashSet is internally implemented using HashMap in Java, so if you know How HashMap works internally in Java, more likely you can figure out how HashSet works in Java. But, now a curious Java developer can question that, how come HashSet uses HashMap because you need a key-value pair to use with Map, while in HashSet we only store one object. Good question, isn't it? If you remember some functionality of the earlier class, then you know that HashMap allows duplicate values, and this property is exploited while implementing HashSet in Java.

When to use ArrayList vs LinkedList in Java? [Answered]

When to use ArrayList or LinkedList in Java is one of the most popular Java interview questions and also asked as a difference between ArrayList and LinkedList. Earlier, I have shared common Java collections interview questions and in this article, I will explain the difference between them. ArrayList and LinkedList are two popular concrete implementations of the List interface from Java's popular Collection framework. Being List implementation both ArrayList and LinkedList are ordered, the index-based and allows duplicate. Despite being from the same type of hierarchy there are a lot of differences between these two classes which makes them popular among Java interviewers.

Top 10 Free and Best Online Courses to Learn Data Structure and Algorithms in Java in 2021 - Best of Lot

Hello guys, In the past, I have shared a lot of useful resources like books and tutorials to learn Data Structure and Algorithms for both beginners and experienced programmers. I have also shared a lot of Data Structure and Algorithmic interview questions like this and their solutions in Java. Still, I have got continuously queries about excellent online courses to learn Data Structure and Algorithms in Java. Even though the topics are completely independent with the programming language, Java developer definitely likes the online courses which teach Data Structure and Algorithms in Java, and that's why my recent post about best algorithms courses, which includes algorithms courses from JavaScript and Python didn't impress my readers.

How to Convert Stream to ArrayList in Java 8 - Collectors.toCollection() Example

You can use Collectors.toList(), toSet(), and toMap() to get all elements of Stream into any Collection like List, Set or Map, but if you want to get a particular collection e.g. ArrayList, then you need to use Collectors.toCollection(ArrayList::new) method. This method first creates an ArrayList using method reference and then adds all elements of Stream into the ArrayList. It's very useful if you have a long list of String and you want to create a smaller list containing only String starting with the letter "b"  like "Bluehost"

Top 10 Free Java Courses in 2021 for Beginners and Experienced Programmers - Best of Lot

Hello guys, the Internet is full of useful resources, and no matter what you want to learn, there is something useful available for free. You just need to commit your time and effort. But at the same time, it's challenging to choose from the massive sea of free tutorials and courses on the internet. If you are not careful, you will spend most of your time browsing and changing classes without learning anything. That's where a curated list helps. Curation is my hobby and passion. I love to read books and courses which allows me to curate useful resources and share them with you guys.

Caused by: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number - Solution

Hello guys, if you are getting below error in your Java program and wondering how to solve this or just stuck then you have come to the right place. In this article, I will explain to you what causes the " java.sql.SQLSyntaxErrorException: ORA-01722: invalid number" error when you connect to an Oracle database from a Java program and how you can solve it. 

But, first of all, let's take a look at the stack trace of this error which looks like below:
Caused by: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number  at oracle.jdbc.driver.T4CTTIoer.processError(
        at oracle.jdbc.driver.T4CTTIoer.processError(
        at oracle.jdbc.driver.T4C8Oall.processError(
        at oracle.jdbc.driver.T4CTTIfun.receive(
        at oracle.jdbc.driver.T4CTTIfun.doRPC(
        at oracle.jdbc.driver.T4C8Oall.doOALL(
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(
        at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(
        at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(
        at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(
        at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(