Posted In: IO, Java Core

How to create a file and write text to it

Techniques used 1. Before JDK 7 using BufferedWriter 2. Using JDK 7 Files 3. Apache Commons IOUtils 4. Guava library  

Read More

by , on August 23rd, 2017

Posted In: Date, Java Core

Calculate number of days between two Java date instances

Calculate difference between two Java date instances Techniques used 1. Using java.util.Date Before JDK 8 2. Using java.time.LocalDate JDK 8 3. Using JODA time org.joda.time.Days 4. Using JODA time org.joda.time.Interval

Read More

by , on August 23rd, 2017

Posted In: Caching, Java Core

Do not forget to add serialVersionUID in your POJO

What is a serialVersionUID and why should developer use it in POJO? Why developer should always add serialVersionUID in POJO. In an enterprise application sooner than later you will start using some caching mechanism. Any changes in POJO even if very small can change UID. In such cases all your cached objects will not work. […]

Read More

by , on August 23rd, 2017

Posted In: Date, Java Core

Parsing ISO 8601-compliant String to java.util.Date

Best way to parse an XML dateTime in Java Techniques used 1. JODA Time 2. JAXB  

Read More

by , on August 23rd, 2017

Posted In: Java Core, String

How to convert a String to an int in Java

Techniques used 1. Using Integer Class 2. Using BigInteger Class 3. Apache Commons IOUtils 4. Guava library  

Read More

by , on August 22nd, 2017

Posted In: IO, Java Core

How to create a Java List from the contents of a file

Techniques used 1. Before JDK 7 using BufferedReader 2. Using JDK 7 Files 3. Apache Commons IOUtils 4. Guava library  

Read More

by , on August 22nd, 2017

Posted In: IO, Java Core

How to create a Java string from the contents of a file

Techniques used 1. Before JDK 7 using BufferedReader 2. Using JDK 7 Files 3. Apache Commons IOUtils 4. Guava library  

Read More

by , on August 22nd, 2017

Posted In: Java Core, String

How do I compare strings in enterprise java application

This is one of the highest viewed question on Stack Overflow (String compare) Though question is more related to ‘==’ vs equals there are more things developer should do while comparing Strings. Null check Most of the Null pointer exception in an application may be caused due to following kind of code To avoid this […]

Read More

by , on August 22nd, 2017

  • Categories