1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-11-18 00:19:32 -08: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 921c176317
commit 22f1b7543a

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;