무한 정보 세상 헤쳐나가기

JAVA HashMap 사용시 warning 처리하기

JAVA 에서 Hashmap을 아래와 같이 사용하면

HashMap<String, Object> list1 = new HashMap();

다음과 같은 warning을 만나게 됩니다.

- Type safety: The expression of type HashMap needs unchecked conversion to conform to HashMap<String,Object>
- HashMap is a raw type. References to generic type HashMap<K,V> should be parameterized

다음과 같이 사용하면 warning이 없어지는데... 일단 정리하고 정확한 이유는 따로 정리해보겠습니다.

warning 이유 정리

HashMap<String, Object> list1 = new HashMap<String, Object>();