• 29 February

    Java long to String

    In this post, we will see how to convert long to String in java. There are lot of ways to convert long to String.Let’s see each one by one. Using Long.toString() You can use Long class toString() method to convert long to String. [crayon-6768013a16a15231456060/] In case, Long can be null and you don’t want to […]

  • Convert LocalDateTime to Date in Java
    15 May

    Java LocalDateTime to Date

    In this post, we will see how to convert LocalDateTime to Date. Java 8 has introduced a lot of new APIs for Date and time. There can be many ways to convert Java LocalDateTime to date. Using Instant object You can convert LocalDateTime to date using Instant object which we can from ZonedDateTime. Here is […]

  • 20 October

    Java Array to Set

    In this post, we will learn java array to set conversion. There are many ways to convert array to set. 1. Using Java 8’s Stream If you are using Java 8, I would recommend using Java 8 Stream. [crayon-6768013a185d3791043777/] Output [John, Martin, Mary] 2. Using HashSet constructor() We can directly call HashSet‘s constructor for java […]

  • 10 August

    Java Collection to List

    In this post, we will see how to convert Java Collection to List. There are many ways to do it, we will see two ways here. Using ArrayList constructor [crayon-6768013a18711061952544/] Above ArrayList‘s constructor creates a list having the elements of the specified collection, in the order they are returned by the collection’s iterator. Using Java […]

  • 10 November

    Java List to String

    In this post, we will see how to convert List to String in java. Following are the ways to convert list into String: Using StringBuilder We can use StringBuilder class to convert List to String. StringBuilder is the best approach if you have other than String Array, List.We can add elements in the object of […]

  • 10 November

    Java Convert Array to List

    In this post, we will see how to convert array to list in java. There are may ways to convert array to list: By using Arrays.asList(): This is an easy method to convert Array into list.We just need to pass array as parameter to asList() method.It is a Static method available in Arrays class so, […]

  • 10 November

    Java convert List to Array

    In this post, we will see how to convert List to Array in java. There are many ways to convert List to Array in java Using toArray() method We can use toArray() method to convert List to String. We can either pass a array of size as List’s length or we can pass empty array. […]

  • 04 November

    How to convert String to Double in Java

    With the introduction of different data types, the need for conversion of one data type to another has come into being. In this article, we are going to see how we can convert from a String data type into Double data type. Conversion Modes There are two ways in which String data can be converted […]

  • 04 November

    How to convert String to int in Java

    In this article, we are going to see how we can convert from a String data type into integer data type in Java. Conversion Modes There are two ways in which String data can be converted into integer. They are: Using the static method parseInt(String) of the java.lang.Integer wrapper class Using the static method valueOf(String) […]