File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is There a Opposite to .equal() ?

 
Matt Midcap
Sheriff
Posts: 440
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say I compare two objects, Obj1 and Obj2 with .equals().
<pre>
if( Obj1.equals(Obj2) )
{
// do something
}
</pre>
This works fine and dandy. But what if I want to do the opposite, "not equals"? I have looked at the API and was unable to find anything like ".notEquals()". So what I what I did (I was in a hurry) was:
<pre>
if( Obj1.equals(Obj2) )
{
// do nothing
}
else
{
// do what is desired
}
</pre>
Thanks in advance,
Matt
 
paul wheaton
Trailboss
Pie
Posts: 21183
Firefox Browser IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about
if ( ! obj1.equals( obj2 ) )

???

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic