Which of the following 5 implementations could not
be used for contains?
public boolean contains(T anEntry)
{
return !isEmpty();
}
-
public boolean contains(T anEntry)
{
boolean found = false;
int i = 0;
while ( !found && (i < numberOfEntries))
{
if (anEntry.equals(contents[i]))
{
found = true;
}
i++;
}
return found;
}
-
public boolean contains(T anEntry)
{
return getIndexOf(anEntry) > -1;
}
-
public boolean contains(T anEntry)
{
return getFrequencyOf(anEntry) > 0;
}
-
public boolean contains(T anEntry)
{
int i = 0;
while ((i < numberOfEntries))
{
if (anEntry.equals(contents[i]))
{
return true;
}
i++;
}
return false;
}
There are no hints for this question