I think this is a wrong assertion:
if (assertEquals(linkName, myElement)){
myElement.click();
}
.. because linkName is a String, myElement is a WebElement and the assertEquals() return value is not boolean (only void). You can check it with String equals(). For example:
if (link.equals(linkName)){
myElement.click();
}