Exemplo n.º 1
0
 private void init() {
   if (this.values != null) {
     return;
   }
   this.values = new HashMap<String, Object>(this.datas.size());
   for (DataItem item : datas) {
     String key = item.getKey();
     Object value = this.getDataType().stringToObject(item.getValue());
     this.values.put(key, value);
   }
 }
Exemplo n.º 2
0
 public void insert(DataItem item) {
   int key = item.getKey();
   int hashVal = hashFunc(key);
   int i = 0;
   while (hashArray[hashVal] != null && hashArray[hashVal].getKey() != -1) {
     ++hashVal;
     hashVal %= arraySize;
     i++;
     if (i == numTry) {
       numTry *= 2;
       DataItem[] hashArray2 = new DataItem[arraySize * 2];
       for (int j = 0; j < arraySize; j++) {
         hashArray2[j] = hashArray[j];
       }
       hashArray = hashArray2;
     }
   }
   hashArray[hashVal] = item;
 }