Do not use == to compare objects as this compares references and not contents. Use the equals method instead.