1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-06-26 04:36:24 -07:00

Change the cache search function to be more generic.

This commit is contained in:
Danila Fedorin 2017-08-03 10:03:13 -07:00
parent 9b71f9aaf4
commit 819fff6391

View File

@ -82,10 +82,10 @@ public class PluginManager {
* @param <T> the type of element being search
* @return the retrieved element, or null if it was not found.
*/
private static <T> T searchCached(Collection<Plugin> plugins, Map<String, T> cache,
java.util.function.Function<Plugin, Set<String>> setFunction,
java.util.function.BiFunction<Plugin, String, T> getFunction,
String name) {
private static <T, K> T searchCached(Collection<Plugin> plugins, Map<K, T> cache,
java.util.function.Function<Plugin, Set<K>> setFunction,
java.util.function.BiFunction<Plugin, K, T> getFunction,
K name) {
if (cache.containsKey(name)) return cache.get(name);
T loadedValue = null;