If the List contains the element you are searching for, then terms.contains will always return true. Why not use indexOf instead?