public Integer call() throws Exception { _barrier.await(); int count = 0; for (TestKey item : _items) { if (_map.contains(item._id)) { System.err.printf("COLLISION DETECTED: %s exists\n", item.toString()); } final TestKey exists = _map.putIfAbsent(item._id, item); if (exists == null) { count++; } else { System.err.printf( "COLLISION DETECTED: %s exists as %s\n", item.toString(), exists.toString()); } } return count; }
@Override public int hashCode() { int hash = iData + (int) lData + key.hashCode(); if (sData != null) { for (int i = 0; i < sData.length; i++) { hash += sData.hashCode(); } } return hash; }
public void write(RepositoryDataOutput out) throws IOException { key.write(out); if (sData == null) { out.writeInt(-1); } else { out.writeInt(sData.length); for (int i = 0; i < sData.length; i++) { out.writeUTF(sData[i]); } } out.writeInt(iData); out.writeLong(lData); }