== Why is this an issue?

include::../description.adoc[]

=== Noncompliant code example

[source,kotlin]
----
val objs = mutableListOf<Any>()
objs.add("Hello")

objs.add(objs) // Noncompliant; StackOverflowException if objs.hashCode() called
objs.addAll(objs) // Noncompliant; behavior undefined
objs.containsAll(objs) // Noncompliant; always true
objs.removeAll(objs) // Noncompliant; confusing. Use clear() instead
objs.retainAll(objs) // Noncompliant; NOOP
----

=== Compliant solution

[source,kotlin]
----
val newList = mutableListOf<Any>()
val objs = mutableListOf<Any>()
objs.add("Hello")

objs.containsAll(newList) // Compliant
objs.addAll(newList) // Compliant
objs.removeAll(newList) // Compliant
objs.retainAll(newList) // Compliant
----

