You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Steve Davis <sd...@broadsoft.com> on 2005/09/22 19:57:15 UTC

comparing enums with == vs. equals()

Is it safe to use the == operator instead of the equals() method 
to inspect a parsed document containing enumerated simpleTypes ?

if (myXmlObject.getColor().equals(Color.BLUE))
{
   if (myXmlObject.getColor() == Color.BLUE)
   {
      System.out.println("equal and ==");
   }
   else
   {
      System.out.println("equal but not ==");
   }  
}



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org