Browsed by
Tag: Core Java

Convert String to Stream to String

Convert String to Stream to String

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 More Read More

Get keys from HashMap in Java

Get keys from HashMap in Java

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 More Read More