Code example for AtomicReferenceArray

0
		private final int shift;
 
		final int bits;
 
		Table(int bits) {
			this.ids = new AtomicReferenceArray<ObjectId>(1 << bits);
			this.shift = 32 - bits;
			this.bits = bits;
		} 
 
		boolean contains(AnyObjectId toFind) {
			int i = index(toFind);
			for (int n = 0; n < MAX_CHAIN; n++) {
				ObjectId obj = ids.get(i);
				if (obj == null)
					break; 
 
				if (AnyObjectId.equals(obj, toFind))
					return true; 
 
				if (++i == ids.length())