Implement this in Java Method to determine if a particular

Implement this in Java

* Method to determine if a particular element is in this set.

* @param target * the element that needs to be found in this set

* @return * true if the target element is in this set, false otherwise

public boolean contains(int target)

{

}

Solution

public boolean contains(int target)
{
boolean flag=false;
for(Integer i:(this))
{
if(target==i.intValue())
{
flag=true;
break;
}
}
return flag;
}

Implement this in Java * Method to determine if a particular element is in this set. * @param target * the element that needs to be found in this set * @return

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site