public void freeObject(int id){
  if (cacheId == id) {
    cacheId=-1;
    cache=null;
  }
  map.remove(id);
}

public void freeObject ( int id ) { if ( cacheId == id ) { cacheId = - 1 ; cache = null ; } map . remove ( id ) ; }
remove an object from the map .
