// The MIT License (MIT)
//
// Copyright (c) 2016 Tim Jones
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
package io.github.jonestimd.finance.swing;

import java.util.List;
import java.util.ServiceLoader;

import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import io.github.jonestimd.finance.plugin.FinancePlugin;
import io.github.jonestimd.finance.plugin.SecurityTableExtension;
import io.github.jonestimd.finance.service.ServiceLocator;
import io.github.jonestimd.finance.swing.event.DomainEventPublisher;

public class PluginContext {
    public static final Function<FinancePlugin, List<? extends SecurityTableExtension>> GET_SECURITY_TABLE_EXTENSION = new Function<FinancePlugin, List<? extends SecurityTableExtension>>() {
        @Override
        public List<? extends SecurityTableExtension> apply(FinancePlugin input) {
            return input.getSecurityTableExtensions();
        }
    };
    private final ServiceLoader<FinancePlugin> plugins;

    public PluginContext(ServiceLocator serviceLocator, DomainEventPublisher domainEventPublisher) {
        plugins = ServiceLoader.load(FinancePlugin.class);
        for (FinancePlugin plugin : plugins) {
            plugin.initialize(serviceLocator, domainEventPublisher);
        }
    }

    public Iterable<SecurityTableExtension> getSecurityTableExtensions() {
        return Iterables.concat(Iterables.transform(plugins, GET_SECURITY_TABLE_EXTENSION));
    }
}

@@ -1193,86 +1193,23 @@
 til.
-List;%0Aimport java.util.ServiceLoader;%0A%0Aimport com.google.common.base.Function;
+ServiceLoader;%0A
 %0Aimp
@@ -1504,401 +1504,78 @@
 er;%0A
-%0Apublic class PluginContext %7B%0A    public static final Function%3CFinancePlugin, List%3C? extends SecurityTableExtension%3E%3E GET_SECURITY_TABLE_EXTENSION = new Function%3CFinancePlugin, List%3C? extends SecurityTableExtension%3E%3E() %7B%0A        @Override%0A        public List%3C? extends SecurityTableExtension%3E apply(FinancePlugin input) %7B%0A            return input.getSecurityTableExtensions();%0A        %7D%0A    %7D;
+import io.github.jonestimd.util.Streams;%0A%0Apublic class PluginContext %7B
 %0A   
@@ -2032,65 +2032,70 @@
 cat(
-Iterables.transform(plugins, GET_SECURITY_TABLE_EXTENSION
+Streams.map(plugins, FinancePlugin::getSecurityTableExtensions
 ));%0A

Replace Guava function with method reference