1 8 9 package com.sleepycat.collections; 10 11 14 final class StoredMapEntry extends MapEntryParameter { 15 16 private BaseIterator iter; 17 private StoredCollection coll; 18 19 StoredMapEntry(Object key, 20 Object value, 21 StoredCollection coll, 22 BaseIterator iter) { 23 24 super(key, value); 25 this.coll = coll; 26 this.iter = iter; 27 } 28 29 public Object setValue(Object newValue) { 30 31 Object oldValue; 32 if (iter != null && iter.isCurrentData(this)) { 33 oldValue = getValue(); 34 iter.set(newValue); 35 } else { 36 if (coll.view.dupsAllowed) { 37 throw new IllegalStateException ("May not insert duplicates"); 38 } 39 oldValue = coll.put(getKey(), newValue); 40 } 41 setValueInternal(newValue); 42 return oldValue; 43 } 44 } 45 | Popular Tags |