static HashMap, Class> loadFunctions_cache = new HashMap; static Lock loadFunctions_cached_lock = lock(); static Class loadFunctions_cached(S... functions) { ret loadFunctions_cached(asList(functions)); } static Class loadFunctions_cached(Collection functions) { Set functionSet = new TreeSet(functions); lock loadFunctions_cached_lock; Class c = loadFunctions_cache.get(functionSet); if (c == null) { loadFunctions_cache.put(functionSet, c = loadFunctions(functionSet)); assertNotNull(loadFunctions_cache.get(functionSet)); } ret c; }