Search code examples
javanetbeansambiguous

NetBeans Error Ambiguous on Method contains(Object)


Can anybody help me to fix this error in NetBeans 8.0.2 ? I am using Java 1.7 on Mac. This error did not occurred in Eclipse. Netbeans always tell me that the method contains(Object) ambiguous within Collection or List, whereas I am using ArrayList in my method.

reference to contains is ambiguous
  both method contains(Object) in Collection and method contains(Object) in List match
----
(Alt-Enter shows hints)

Screenhost error on NetBeans 8.0.2


Solution

  • That's... just... weird. List inherits from Collection and overrides the contains(Object) method, which is implemented in ArrayList. This works fine in Eclipse.

    Looks like a serious bug in NetBeans to me.

    I recommend reinstalling NetBeans from scratch to see if that fixes the problem.