HashMap getAHashMap() { return new HashMap(); } HashMap list = getAHashMap(); list.put("hi", 1); //anyway to not get a warning with this pseudo snippet? //here... Type safety: The method put(Object, Object) belongs to the raw type HashMap. References to generic type HashMap should be parameterized