Before we go ahead and explore Apache Commons EqualsBuilder and HashCodeBuilder we must know the relationship between equals and hashCode.
java.lang.Object which is the super class of all Java classes has two very important methods defined in it. They are –
- public boolean equals(Object obj)
- public int hashCode()
These two methods are very important when our classes deal with other Java classes such as Collection API used for searching, sorting, comparison and eliminate duplicate objects from a set.
Exchangeable image file format (Exif) is a specification for the image file format used by digital cameras. The specification uses the existing JPEG, TIFF Rev. 6.0, and RIFF WAV file formats, with the addition of specific metadata tags. As we are now aware of what these things are, why not write a Small Java application to extract these data. But developing a full-fledged API is beyond the scope of this blog. So, I chose to use Sanselan from Apache Foundation. This Pure-Java library reads and writes a variety of image formats, including fast parsing of image info (size, color space, icc profile, etc.) and metadata. You can download it from Apache website at http://commons.apache.org/sanselan/download_sanselan.cgi. Using Sanselan, it is very easy to read Exif tags. I have written a small piece of code to get the basic information of an image. The steps required to perform are as follows: