In the method addNoDuplicateSources, the if statement has an error message - incompatible types.
The input parameter to the method is a string and the return parameter from the getSource() method
is a String. Why would the if statement give an incompatible types message.?
import java.util.*; public class AnotherWord { private String word; private Vector<String> sourceList; private int count; public AnotherWord( String word, String source ) { this.word = word.toLowerCase(); count = 1; sourceList = new Vector<String> (3,2); sourceList.add( (String) source ); } public void addNoDuplicateSources( String sourceToAdd) { boolean found = false; for (int i = 0; i <= sourceList.size(); i++) { if ( getSource(i).compareToIgnoreCase(sourceToAdd) ) { found = true; } } if (!found) { sourceList.add( sourceToAdd ); } } public String getSource(int index) { String result = null; if (index >=0 && index < sourceList.size()) { result = sourceList.get(index); } return result; } }