Use containsKey not contains

Code uses contains as a guard against doing a put, but contains checks values, not keys...so that test will always succeed (as contains will always return false) ..  use containsKey instead.