Category Archives for Java

Java – Read from File

How to read a file in Java? Learn what are the different ways to read file including BufferReader and the new Java 8 Stream API.

Continue reading

Convert inputstream to String in Java

Updated on April 28th, 2018Convert InputStream to String in Java Converting InputStream to String in Java is a very common operation, in this post, We will cover how to Convert InputStream to String in Java using Apache Commons IOUtils Java   1. Apache Common One of the clean ways to Convert InputStream to String in Java is […]

Continue reading

Java Sorting Example(Comparable and Comparator)

Updated on February 3rd, 2019Java Sorting Example(Comparable and Comparator) In this article, we will cover Java Sorting Example (Comparable and Comparator). Java Collection API provides a way to sort Array and Lists but it expects input from the developer. This article will try to give an example to use both java.lang.Comparable and java.util.Comparator to sort objects.   1. Sort […]

Continue reading

Convert String to int in Java

Updated on May 12th, 2018Convert String to int in Java There are few ways to Convert String to int in Java. Below are few of popular ways for converting String to int Integer.parseInt() Integer.valueOf() 1.  Integer.parseInt() Examples Integer.ParseInt()  will return an int primitive value.If efficiency is your concern and you only need primitive value, then using Integer.ParseInt()  […]

Continue reading

Java Comparable vs Comparator

Updated on January 24th, 2019Java Comparable vs Comparator In this articles we will discuss Java Comparable vs Comparator, often people have  lots of questions when it comes to Java Comparable vs Comparator What is Comparable and what is Comparator in Java How do we use them What is the difference between Comparable and Comparator? When we […]

Continue reading