第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Java泛型問題

Java泛型問題

瀟湘沐 2019-03-06 14:15:10
第三行代碼有警告,請問怎樣去除。報錯信息我注釋在了警告行上面。class MyHashMap<K, V> {    public static final int SIZE = 1000;    //Type safety: The expression of type MyHashMap.Entry[] needs unchecked conversion to conform to MyHashMap.Entry<K,V>[]    public Entry<K, V>[] tables = new Entry[SIZE];        public void put(K key, V value) {        int index = key.hashCode() % SIZE;        while(tables[index] != null) {            index++;        }        tables[index] = new Entry<K, V>();        tables[index].key = key;        tables[index].value = value;        tables[index].hash = key.hashCode();    }        public V get(K key) {        int index = key.hashCode() % SIZE;        while(tables[index] != null && key.hashCode() !=  tables[index].hash                &&!key.equals(tables[index].key)) {            index++;        }        return tables[index].value;    }        static class Entry<K, V> {        int hash;        K key;        V value;    }}
查看完整描述

2 回答

?
慕尼黑的夜晚無繁華

TA貢獻1864條經(jīng)驗 獲得超6個贊

@suppresswarnings("unchecked")


查看完整回答
反對 回復(fù) 2019-04-24
?
aluckdog

TA貢獻1847條經(jīng)驗 獲得超7個贊

泛型類型是不能定義數(shù)組的。。


查看完整回答
反對 回復(fù) 2019-04-24
  • 2 回答
  • 0 關(guān)注
  • 414 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號