CacheKey implements Cloneable, Serializable { public void update(Object object) { if (object != null && object.getClass().isArray()) { int length = Array.getLength(object); for (int i = 0; i < length; i++) { Object element = Array.get(object, i); doUpdate(element); } } else { doUpdate(object); } } CacheKey();  CacheKey(Object[] objects); int getUpdateCount(); void update(Object object); void updateAll(Object[] objects); @Override boolean equals(Object object); @Override int hashCode(); @Override String toString(); @Override CacheKey clone(); static final CacheKey NULL_CACHE_KEY; }
@Test public void shouldDemonstrateEmptyAndNullKeysAreEqual() { CacheKey key1 = new CacheKey(); CacheKey key2 = new CacheKey(); assertEquals(key1, key2); assertEquals(key2, key1); key1.update(null); key2.update(null); assertEquals(key1, key2); assertEquals(key2, key1); key1.update(null); key2.update(null); assertEquals(key1, key2); assertEquals(key2, key1); }