Core Java

Convert String to Stream to String

Posted on

In java programming language, String is most widely used class. In certain situations we need to convert String to stream and vice versa. One such scenario is while reading data from a file, we have to convert stream to String. In this blog, we will see how to convert String to Stream and vise versa.You can learn more about String and other classes related with String like StringBuffer and StringBuilder in detail in String in java, StringBuffer in java and StringBuilder in java. Read the rest of this entry »

Convert String to boolean in java

Posted on Updated on

In Java programming, developers often comes in the situation where they have to convert String into different datatype like int, double, boolean and so on. In previous blog, we have written how one can convert String to int in java. Here in this blog we will see how to convert String to boolean in java. Read the rest of this entry »

User-defined Exceptions

Posted on Updated on

Java provides many built-in exception but at many times built-in exceptions are not able to describe a certain situation. In such cases, like the built-in exception, the programmer can also create his own exception which are called user-defined exception.

Read the rest of this entry »

Get keys from HashMap in Java

Posted on Updated on

One of most likely situation we seek is get keys of values from HashMap. While iterating through HashMap, there might be different scenarios as how mapping of key to value is done. 

We’ll discuss and see how we can get key/s of value/s of below mentioned pattern-

  1. Key to Value: Many to One (Many keys with same value)
  2. Key to Value: One to One (Every Key has unique value)

Read the rest of this entry »