public static synchronized UnitTable findTable(FactionRecord faction,int unitType,int year,String rating,Collection<Integer> weightClasses,int networkMask,Collection<EntityMovementMode> movementModes,Collection<MissionRole> roles,int roleStrictness,FactionRecord deployingFaction){
  Objects.requireNonNull(faction);
  CacheKey key=new CacheKey(faction,unitType,year,rating,weightClasses,networkMask,movementModes,roles,roleStrictness,deployingFaction);
  UnitTable retVal=cache.get(key);
  if (retVal == null) {
    retVal=new UnitTable(key);
    if (retVal.hasUnits()) {
      cache.put(key,retVal);
    }
  }
  return retVal;
}

public static synchronized UnitTable findTable ( FactionRecord faction , int unitType , int year , String rating , Collection < Integer > weightClasses , int networkMask , Collection < EntityMovementMode > movementModes , Collection < MissionRole > roles , int roleStrictness , FactionRecord deployingFaction ) { Objects . requireNonNull ( faction ) ; CacheKey key = new CacheKey ( faction , unitType , year , rating , weightClasses , networkMask , movementModes , roles , roleStrictness , deployingFaction ) ; UnitTable retVal = cache . get ( key ) ; if ( retVal == null ) { retVal = new UnitTable ( key ) ; if ( retVal . hasUnits ( ) ) { cache . put ( key , retVal ) ; } } return retVal ; }
checks the cache for a previously generated table meeting the criteria . if none is found , generates it and adds it to the cache .
