check all purchase using methos equals without operator if
Hello
How check all purchase using methos equals without operator if.
I have next code:
Code :
for(Purchase purchase : listShop)
{
//output in console
System.out.println(purchase);
//found max cost purchase
if(purchase.getCost() > maxCost)
{
maxCost = purchase.getCost();
}
//check equals all purchase
if(equalResult)
{
equalResult = purchase.equals(listShop[0]);
}
}
}
How change without if: if(equalResult)
{
equalResult = purchase.equals(listShop[0]);
}
Re: check all purchase using methos equals without operator if
I have no idea what you're asking. Please see the link in my signature on asking questions the smart way, as well as this link: http://www.javaprogrammingforums.com...-get-help.html
Re: check all purchase using methos equals without operator if
i mean, how use this code without if
if(equalResult)
{
equalResult = purchase.equals(listShop[0]);
}
Re: check all purchase using methos equals without operator if
I don't know, because I don't know what that code is supposed to do. You have not posted any code that will compile, let alone run, so it's pretty hard to tell you a different way to do it.
Re: check all purchase using methos equals without operator if
Sorry,
its code:
Code :
for(Purchase purchase : listShop)
{
//output in console
System.out.println(purchase);
//found max cost purchase
if(purchase.getCost() > maxCost)
{
maxCost = purchase.getCost();
}
//check equals all purchase
if(equalResult)
{
equalResult = purchase.equals(listShop[0]);
}
}
How change
if(equalResult)
{
equalResult = purchase.equals(listShop[0]);
}
but without operator if?
Re: check all purchase using methos equals without operator if
Sigh. That's just a repost of your original post, which I already told you wasn't enough. What is equalResult supposed to be? What is this code supposed to do? Did you read the links I gave you? Did you create an SSCCE like I asked?