• Difference between map and flatmap in java
    16 October

    Difference between map and flatMap in java

    In this post, we will see the difference between map and flatMap in java.I have already covered Stream’s map and flatMap methods  in previous articles. As you might know, Stream’s map and flatMap method both can be applied on Stream<T> and return Stream<R> as output. The actual difference is, map operation produces one output value […]

  • Java 8 Stream flatmap
    15 October

    Java 8 Stream flatMap

    In this post, we will see about Java 8 Stream flatMap function.Before understanding flatMap, you should go through stream’s map function Stream‘s flatMap method takes single element from input stream and produces any number of output values and flattens result to output stream.When you apply flatMap function on each of element of the stream, it results in […]

  • Java 8 Stream map
    15 October

    Java 8 Stream Map

    In this post, we will see about Java 8 Stream map function. stream‘s map method takes single element from input stream and produces single element to output stream. Type of Single input Stream and Output stream can differ. Java 8 Stream Map function [crayon-67430272cfd4a439540836/] Map function returns a stream consisting of the results of applying […]

  • 12 October

    Java BigDecimal

    In this post, we will see about Java BigDecimal class. BigDecimal class contains Arithmetic operations, rounding, comparison, scaling. It provides high precision arithmetic operations, so generally used to handle numbers in banking and financial domain. Java BigDecimal provides a lot of options to control rounding. You can choose various rounding modes such as round half […]

  • 05 October

    Java BigDecimal to String

    In this post, we will see how to convert BigDecimal to String in java. There are many ways to convert BigDecimal to String in java. Some of them are: Using toString() Using String.valueOf() toString method You can simply use BigDecimal’s toString method to convert BigDecimal to String. [crayon-67430272cffd6965564563/] When you run above program, you will […]

  • 05 October

    Java String to BigDecimal

    In this post, we will see how to convert String to BigDecimal in java. It is very simple to convert String to BigDecimal in java. You can simply use BigDecimal ‘s String based constructor to do it. [crayon-67430272d0090417268905/] Above constructor convert String representation of BigDecimal to BigDecimal Let’s see this with the help of example: [crayon-67430272d0093187737346/] […]

  • 28 September

    Java String Replace

    Java String replace method replaces all occurrences of old char to new char or old CharSequence to new CharSequence and return new String. If there is nothing to replace in the String, it will return same String. Let’s say you need to convert "Java2blog" to "JavaTwoblog", you can simply use below syntax. [crayon-67430272d01ba075481013/] Syntax There […]

  • 25 September

    List vs ArrayList in java

    In this post, we will see the difference between List and ArrayList in Java. List is an interface where ArrayList is concrete implementation, so List is more generic than ArrayList. You can instance an ArrayList in below two ways.You might have seen this code before. [crayon-67430272d02b5815346470/] If you use 1st way, you can change the […]

  • 24 September

    How to convert List to Set in java

    In this post, we will see how to convert List to Set in java.We will convert ArrayList to HashSet. As HashSet does not allow duplicates, when you convert ArrayList to HashSet, all the duplicates will be discarded. You can simply use the constructor of HashSet to convert ArrayList to HashSet. [crayon-67430272d0368949895383/] Here is simple example: […]