Add a WeakCollection utility class.

This class is designed to be an invisible layer between a normal collection,
and one that silently loses entries because they are only weakly referencable.
Some operations have additional overhead to be semantically correct, but it
maintains the equals contract for all entries, as opposed to identity.

It does not support the equals or hash code method as it cannot easily have
the transitive and commutative properties.

Remapped by Srg2Source from Bukkit/CraftBukkit@8be13fa18624b7c836d81103930b91745e4ca20f