Wrap entry in a separate object instance. We can return the entry directly, however we lock on
the entry object.
545649
protected CacheEntry<K, V> returnEntry(final ExaminationEntry<K, V> e) {
    if (e == null) {
      return null;
    }
    return returnCacheEntry(e);
  }
1287846
protected static <T> T callClosureForMapEntry(Closure<T> closure, Map.Entry entry) {
        if (closure.getMaximumNumberOfParameters() == 2) {
            return closure.call(new Object[]{entry.getKey(), entry.getValue()});
        }
        return closure.call(entry);
    }
216074
function(entry) {
        var keys = entry.keys;
        var obj = entry.obj;
        var cell, i, j, m, n;

        //First delete current object from appropriate cells
        for (i = keys.x1; i <= keys.x2; i++) {
            for (j = keys.y1; j <= keys.y2; j++) {
                cell = this.map[(i << 16) ^ j];
                if (cell) {
                    n = cell.length;
                    //loop over objs in cell and delete
                    for (m = 0; m < n; m++)
                        if (cell[m] && cell[m][0] === obj[0]) cell.splice(m, 1);
                }
            }
        }

        //update keys
        HashMap.key(obj, keys);

        //insert into all rows and columns
        for (i = keys.x1; i <= keys.x2; i++) {
            for (j = keys.y1; j <= keys.y2; j++) {
                cell = this.map[(i << 16) ^ j];
                if (!cell) cell = this.map[(i << 16) ^ j] = [];
                cell.push(obj);
            }
        }

        //mark map boundaries as dirty
        this.boundsDirty = true;

        return entry;
    }
637805
public Scriptable wrapNewObject(Context cx, Scriptable scope, Object obj)
    {
        if (obj instanceof Scriptable) {
            return (Scriptable)obj;
        }
        Class<?> cls = obj.getClass();
        if (cls.isArray()) {
            return NativeJavaArray.wrap(scope, obj);
        }
        return wrapAsJavaObject(cx, scope, obj, null);
    }
985781
def ensure_object(self, object_type):
        
        rv = self.find_object(object_type)
        if rv is None:
            self.obj = rv = object_type()
        return rv
731093
def wrap( obj )
      ptr = FFI::MemoryPointer.new( :uint64 )
      ptr.write_uint64( obj.object_id )
      ptr
    end
152220
def require(self, lock, guard_func, *guard_args, **guard_kw):
        
        def decorator(f):
            @wraps(f)
            def wrapper(*args, **kw):
                if self.granted(lock):
                    self.msg('Granted {}'.format(lock))
                    return f(*args, **kw)
                if guard_func(*guard_args, **guard_kw) and self.acquire(lock):
                    return f(*args, **kw)
                return None
            return wrapper
        return decorator
710874
public <C> Callable<C> wrap(final Callable<C> c) {
    return new Callable<C>() {
      @Override
      public C call() throws Exception {
        Context previous = attach();
        try {
          return c.call();
        } finally {
          detach(previous);
        }
      }
    };
  }
850453
@SuppressWarnings({ "unchecked", "static-method" })
	@Pure
	final <O> O unwrap(O obj) {
		O unwrapped = obj;
		if (obj instanceof TerminalConnection) {
			unwrapped = (O) ((TerminalConnection) obj).getWrappedRoadConnection();
		} else if (obj instanceof WrapSegment) {
			unwrapped = (O) ((WrapSegment) obj).getWrappedSegment();
		}
		assert unwrapped != null;
		return unwrapped;
	}
917323
private static <E extends Throwable> E wrapIfNecessary(Throwable throwable)
			throws RetryException {
		if (throwable instanceof Error) {
			throw (Error) throwable;
		}
		else if (throwable instanceof Exception) {
			@SuppressWarnings("unchecked")
			E rethrow = (E) throwable;
			return rethrow;
		}
		else {
			throw new RetryException("Exception in retry", throwable);
		}
	}
827573
function injectableWrapper(obj, provide, injects, isTransientScope) {
    // TODO(@davequick): discuss with @halfspiral whether isTransientScope might just better
    // be an array of Annotations
    var wrappedObject = function wrapOrCreateObject() {
      if(isFunction(obj) && (exists(obj.$provide) || exists(obj.$inject) || provide || injects)){
        var instance = Object.create(obj.prototype);
        return obj.apply(instance,arguments) || instance;
      }
      return obj;
    };
    return _wrapper(obj, wrappedObject, provide, injects, isTransientScope);
  }
1122769
private Entry<K, V> getEntry(K key) {
        final K k = key;
        
        return new Entry<K, V>() {
            public boolean equals(Object ob) {
                if( ob instanceof Entry ) {
                    Entry entry = (Entry)ob;
                    
                    if( !entry.getKey().equals(getKey()) ) {
                        return false;
                    }
                    if( !entry.getValue().equals(getValue()) ) {
                        return false;
                    }
                    return true;
                }
                return false;
            }

            public K getKey() {
                return k;
            }

            public V getValue() {
                return ConcurrentCache.this.get(getKey());
            }

            public V setValue(V val) {
                return ConcurrentCache.this.put(getKey(), val);
            }
        };
    }
1074596
def wrap(self, value):
        ''' '''
        self.validate_wrap(value)
        return self.type.wrap(value)
991002
def _wrap(self, value):
        
        if isinstance(value, dict):
            if any(isinstance(name, int) for name in value.keys()):
                if not all(isinstance(name, int) for name in value.keys()):
                    raise RuntimeError("Integer and non-integer keys: %r"
                                       % value.keys())
                items = sorted(value.iteritems(), key=itemgetter(0))
                return [self._wrap(val) for _, val in items]
            else:
                return Arguments(value)
        elif isinstance(value, list):
            return [self._wrap(x) for x in value]
        else:
            return value
224702
def wrapinstance(ptr, base=None):
    """"""
    if ptr is None:
        return None
    ptr = long(ptr)  # Ensure type
    from wishlib.qt import active, QtCore, QtGui
    if active == "PySide":
        import shiboken
        if base is None:
            qObj = shiboken.wrapInstance(ptr, QtCore.QObject)
            metaObj = qObj.metaObject()
            cls = metaObj.className()
            superCls = metaObj.superClass().className()
            if hasattr(QtGui, cls):
                base = getattr(QtGui, cls)
            elif hasattr(QtGui, superCls):
                base = getattr(QtGui, superCls)
            else:
                base = QtGui.QWidget
        return shiboken.wrapInstance(ptr, base)
    elif active == "PyQt4":
        import sip
        return sip.wrapinstance(ptr, QtGui.QWidget)
    return None
1275023
def _wrap(method: Callable, wrapper: Callable) -> Callable:
        
        def wrapped(*args, **kwargs):
            return wrapper(method, *args, **kwargs)
        return wrapped
558148
def tap(self, interceptor):
        
        interceptor(self.obj)
        return self._wrap(self.obj)