How to avoid unchecked cast warnings with Java Generics

前端 未结 3 1602
慢半拍i
慢半拍i 2020-12-06 16:40

Somehow my old question was closed, so I open a new one:

I am using Java Generics to implement a generic bidirectional Hash Map out of an SQL Query. It should be abl

3条回答
  •  生来不讨喜
    2020-12-06 17:09

    You can use the following annotation to make the compiler not output those warnings:

    @SuppressWarnings("unchecked")
    

    See this related question which deals with the same issue. The answer there will explain everything you need to know.

提交回复
热议问题