Initialize Java Generic Array of Type Generic

后端 未结 2 838
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 13:51

So I have this general purpose HashTable class I\'m developing, and I want to use it generically for any number of incoming types, and I want to also initialize the internal

2条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 14:52

    Also, you can suppress the warning on a method by method basis using annotations:

    @SuppressWarnings("unchecked")
    public HashTable(int initialSize) {
        ...
        }
    

提交回复
热议问题