In Java there are different methods for testing if two objects are "equal":
== means "Is this the exact same instance, i.e. do these two objects refer to the same space in memory?"
you'd rather use Object#equals(), which means "do these two objects have the same properties?"
Anyways, you'd rather check if ItemStack#getItem() is a diamond, because otherwise the check would only return true when the player is holding exactly one diamond. (Or you could use ItemStack#areItemsEqual(), which does basically the same.