Example usage for com.google.common.collect Multimap keys

List of usage examples for com.google.common.collect Multimap keys

Introduction

In this page you can find the example usage for com.google.common.collect Multimap keys.

Prototype

Multiset<K> keys();

Source Link

Document

Returns a view collection containing the key from each key-value pair in this multimap, without collapsing duplicates.

Usage

From source file:eu.uqasar.util.UQasarUtil.java

/**
 * Traverse the tree in postorder and update tree values
 * @param node//from  w  ww .j a v  a 2s.c o  m
 */
private static void postorder(TreeNode node) {

    if (node == null) {
        return;
    }

    logger.debug("------------postorder: " + node.getName() + "---------------");

    // Iterate the node children
    for (Object o : node.getChildren()) {
        TreeNode nodeChild = (TreeNode) o;
        UQasarUtil.postorder(nodeChild);
    }
    logger.debug("Traversing project tree in postorder..." + node.toString());
    // Update the value
    try {
        InitialContext ic = new InitialContext();
        AdapterDataService adapterDataService = new AdapterDataService();
        TreeNodeService treeNodeService = (TreeNodeService) ic.lookup("java:module/TreeNodeService");

        if (node instanceof Metric) {
            Metric metric = (Metric) node;
            logger.debug("Recomputing the value of the Metric " + node);
            Float value = null;
            if (metric.getMetricSource() == MetricSource.Manual) {
                metric.updateQualityStatus();
            } else {
                value = adapterDataService.getMetricValue(metric.getMetricSource(), metric.getMetricType(),
                        metric.getProject());
                metric.setValue(value);
            }
            metric.setLastUpdated(getLatestTreeUpdateDate());
            metric.addHistoricValue();
            // End Metric node treatment 
        } else if (node instanceof QualityIndicator) {
            logger.info("Recomputing the value of the Quality Indicator " + node);
            QualityIndicator qi = (QualityIndicator) node;
            if (qi.getUseFormula()) {
                String formulaToEval = Formula.parseFormula(qi.getViewFormula());
                if (formulaToEval != null && !formulaToEval.isEmpty()) {

                    Float computedValue = Formula.evalFormula(formulaToEval);
                    if (computedValue != null && !computedValue.isNaN()) {
                        qi.setValue(computedValue);
                        qi.setLastUpdated(getLatestTreeUpdateDate());
                        treeNodeService.update(qi);
                    }

                }
            } else {
                float achieved = 0;
                float denominator = 0;
                for (final TreeNode me : qi.getChildren()) {
                    float weight = ((Metric) me).getWeight();
                    if (me.getQualityStatus() == QualityStatus.Green) {
                        achieved += weight;
                    }
                    denominator += weight;
                }
                if (denominator == 0)
                    qi.getChildren().size();
                qi.setValue(achieved * 100 / denominator);
            }
            qi.setLastUpdated(getLatestTreeUpdateDate());
            qi.addHistoricValue();
            // End Q.Indicator node treatment 
        } else if (node instanceof QualityObjective) {
            logger.info("Recomputing the value of the Quality Objective " + node);
            QualityObjective qo = (QualityObjective) node;
            if (qo.getUseFormula()) {
                String formulaToEval = Formula.parseFormula(qo.getViewFormula());
                if (formulaToEval != null && !formulaToEval.isEmpty()) {

                    Float computedValue = Formula.evalFormula(formulaToEval);
                    if (computedValue != null && !computedValue.isNaN()) {
                        qo.setValue(computedValue);
                        qo.setLastUpdated(getLatestTreeUpdateDate());
                    }

                }
            } else {
                float denominator = 0;
                float achieved = 0;
                for (final TreeNode qi : qo.getChildren()) {
                    float weight = ((QualityIndicator) qi).getWeight();
                    if (qi.getQualityStatus() == QualityStatus.Green) {
                        achieved += weight;
                    }
                    denominator += weight;
                }
                qo.setValue(achieved * 100 / denominator);
            }
            qo.setLastUpdated(getLatestTreeUpdateDate());
            qo.addHistoricValue();
            // End Quality Objective node treatment 
        } else if (node instanceof Project) {
            logger.info("Recomputing the value of the Project " + node);
            Project prj = (Project) node;
            double qoValueSum = 0;
            double denominator = 0;
            for (Object o : node.getChildren()) {
                QualityObjective qo = (QualityObjective) o;
                if (qo.getWeight() == 0) {
                    continue;
                }
                qoValueSum += qo.getValue() * (prj.isFormulaAverage() ? qo.getWeight() : 1);
                denominator += prj.isFormulaAverage() ? qo.getWeight() : 1;
            }

            // bad idea to divide something under 0
            if (denominator == 0) {
                denominator = 1;
            }

            Double computedValue = qoValueSum / denominator;

            if (computedValue != null && !computedValue.isNaN() && !computedValue.isInfinite()) {
                prj.setValue(computedValue);
            }

            prj.setLastUpdated(getLatestTreeUpdateDate());
            prj.addHistoricValue();
            logger.debug(" [" + qoValueSum + "] denominator [" + denominator + "] " + computedValue);
            // End Project node treatment 
        }

        // Get a (possible) suggestion for the tree node
        Multimap<?, ?> suggestions = getSuggestionForNode(node);
        //TODO: take all the suggestions into account
        Object[] types = suggestions.keys().toArray();
        Object[] suggestionsValues = suggestions.values().toArray();
        if (types.length > 0) {
            // for now use the first item as suggestion
            SuggestionType stype = (SuggestionType) types[0];
            node.setSuggestionType(stype);
            if (suggestionsValues[0] != null && !suggestionsValues[0].equals("")) {
                node.setSuggestionValue((String) suggestionsValues[0]);
            }
        }

        treeNodeService.update(node);

    } catch (NamingException e) {
        e.printStackTrace();
    }

    return;
}

From source file:eu.uqasar.util.UQasarUtil.java

/**
 * Traverse the tree in postorder and update tree values
 * @param node//from   www  . ja  v  a  2  s  . co m
 */
private static void postorderWithParticularNode(TreeNode node, TreeNode projectTreeNode) {

    if (node == null) {
        return;
    }

    if (projectTreeNode == null) {
        return;
    }

    logger.debug("------------postorder: " + projectTreeNode.getName() + "---------------");

    logger.debug("Traversing project tree in postorder..." + projectTreeNode.toString());
    // Update the value
    try {
        InitialContext ic = new InitialContext();
        AdapterDataService adapterDataService = new AdapterDataService();
        TreeNodeService treeNodeService = (TreeNodeService) ic.lookup("java:module/TreeNodeService");

        if (projectTreeNode instanceof Metric) {
            Metric metric = (Metric) projectTreeNode;
            logger.debug("Recomputing the value of the Metric " + projectTreeNode);
            Float value = null;
            if (metric.getMetricSource() == MetricSource.Manual) {
                metric.updateQualityStatus();
            } else {
                value = adapterDataService.getMetricValue(metric.getMetricSource(), metric.getMetricType(),
                        metric.getProject());
                metric.setValue(value);
            }
            metric.setLastUpdated(getLatestTreeUpdateDate());
            metric.addHistoricValue();
            // End Metric node treatment 
        } else if (projectTreeNode instanceof QualityIndicator) {
            logger.info("Recomputing the value of the Quality Indicator " + projectTreeNode);
            QualityIndicator qi = (QualityIndicator) projectTreeNode;
            if (qi.getUseFormula()) {
                String formulaToEval = Formula.parseFormula(qi.getViewFormula());
                if (formulaToEval != null && !formulaToEval.isEmpty()) {

                    Float computedValue = Formula.evalFormula(formulaToEval);
                    if (computedValue != null && !computedValue.isNaN()) {
                        qi.setValue(computedValue);
                        qi.setLastUpdated(getLatestTreeUpdateDate());
                        treeNodeService.update(qi);
                    }

                }
            } else {
                float achieved = 0;
                float denominator = 0;
                for (final TreeNode me : qi.getChildren()) {
                    float weight = ((Metric) me).getWeight();
                    if (me.getQualityStatus() == QualityStatus.Green) {
                        achieved += weight;
                    }
                    denominator += weight;
                }
                if (denominator == 0)
                    qi.getChildren().size();
                qi.setValue(achieved * 100 / denominator);
            }
            qi.setLastUpdated(getLatestTreeUpdateDate());
            qi.addHistoricValue();
            // End Q.Indicator node treatment 
        } else if (projectTreeNode instanceof QualityObjective) {
            logger.info("Recomputing the value of the Quality Objective " + projectTreeNode);
            QualityObjective qo = (QualityObjective) projectTreeNode;
            if (qo.getUseFormula()) {
                String formulaToEval = Formula.parseFormula(qo.getViewFormula());
                if (formulaToEval != null && !formulaToEval.isEmpty()) {

                    Float computedValue = Formula.evalFormula(formulaToEval);
                    if (computedValue != null && !computedValue.isNaN()) {
                        qo.setValue(computedValue);
                        qo.setLastUpdated(getLatestTreeUpdateDate());
                    }

                }
            } else {
                float denominator = 0;
                float achieved = 0;
                for (final TreeNode qi : qo.getChildren()) {
                    float weight = ((QualityIndicator) qi).getWeight();
                    if (qi.getQualityStatus() == QualityStatus.Green) {
                        achieved += weight;
                    }
                    denominator += weight;
                }
                qo.setValue(achieved * 100 / denominator);
            }
            qo.setLastUpdated(getLatestTreeUpdateDate());
            qo.addHistoricValue();
            // End Quality Objective node treatment 
        } else if (projectTreeNode instanceof Project) {
            logger.info("Recomputing the value of the Project " + projectTreeNode);
            Project prj = (Project) projectTreeNode;
            double qoValueSum = 0;
            double denominator = 0;
            for (Object o : projectTreeNode.getChildren()) {
                QualityObjective qo = (QualityObjective) o;
                if (qo.getWeight() == 0) {
                    continue;
                }
                qoValueSum += qo.getValue() * (prj.isFormulaAverage() ? qo.getWeight() : 1);
                denominator += prj.isFormulaAverage() ? qo.getWeight() : 1;
            }

            // bad idea to divide something under 0
            if (denominator == 0) {
                denominator = 1;
            }

            Double computedValue = qoValueSum / denominator;

            if (computedValue != null && !computedValue.isNaN() && !computedValue.isInfinite()) {
                prj.setValue(computedValue);
            }

            prj.setLastUpdated(getLatestTreeUpdateDate());
            prj.addHistoricValue();
            logger.debug(" [" + qoValueSum + "] denominator [" + denominator + "] " + computedValue);
            // End Project node treatment 
        }

        // Get a (possible) suggestion for the tree node
        Multimap<?, ?> suggestions = getSuggestionForNode(projectTreeNode);
        //TODO: take all the suggestions into account
        Object[] types = suggestions.keys().toArray();
        Object[] suggestionsValues = suggestions.values().toArray();
        if (types.length > 0) {
            // for now use the first item as suggestion
            SuggestionType stype = (SuggestionType) types[0];
            projectTreeNode.setSuggestionType(stype);
            if (suggestionsValues[0] != null && !suggestionsValues[0].equals("")) {
                projectTreeNode.setSuggestionValue((String) suggestionsValues[0]);
            }
        }

        treeNodeService.update(projectTreeNode);

    } catch (NamingException e) {
        e.printStackTrace();
    }

    // Iterate the node children
    TreeNode nodeChild = projectTreeNode.getParent();
    UQasarUtil.postorderWithParticularNode(projectTreeNode, nodeChild);

    return;
}

From source file:org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventFieldRequirement.java

@Override
public boolean test(ITmfTrace trace) {

    if (!(trace instanceof ITmfTraceWithPreDefinedEvents)) {
        return true;
    }/* w  w w  .  j a va2  s.  com*/

    Set<String> values = getValues();
    if (values.isEmpty()) {
        return true;
    }

    final Multimap<@NonNull String, @NonNull String> traceEvents = TmfEventTypeCollectionHelper
            .getEventFieldNames((((ITmfTraceWithPreDefinedEvents) trace).getContainedEventTypes()));

    if (fEventName.isEmpty()) {
        switch (getPriorityLevel()) {
        case ALL_OR_NOTHING:
            return traceEvents.keys().stream().allMatch(eventName -> {
                Collection<@NonNull String> fields = new HashSet<>(traceEvents.get(eventName));
                fields.retainAll(values);
                return (fields.size() == 0 || fields.size() == values.size());
            });
        case AT_LEAST_ONE:
            return traceEvents.keys().stream().allMatch(eventName -> {
                Collection<@NonNull String> fields = new HashSet<>(traceEvents.get(eventName));
                fields.retainAll(values);
                return fields.size() > 0;
            });
        case MANDATORY:
            return traceEvents.keys().stream().allMatch(eventName -> {
                Collection<@NonNull String> fields = traceEvents.get(eventName);
                return fields.containsAll(values);
            });
        case OPTIONAL:
            return true;
        default:
            throw new IllegalStateException("Unknown value level: " + getPriorityLevel()); //$NON-NLS-1$
        }
    }

    // Check the level for required event only
    Collection<@NonNull String> fields = traceEvents.get(fEventName);
    switch (getPriorityLevel()) {
    case ALL_OR_NOTHING:
        fields.retainAll(values);
        return (fields.size() == 0 || fields.size() == values.size());
    case AT_LEAST_ONE:
        fields.retainAll(values);
        return fields.size() > 0;
    case MANDATORY:
        return fields.containsAll(values);
    case OPTIONAL:
        return true;
    default:
        throw new IllegalStateException("Unknown value level: " + getPriorityLevel()); //$NON-NLS-1$
    }

}

From source file:org.sonar.db.user.GroupMembershipDao.java

public Multiset<String> countGroupByLoginsAndOrganization(DbSession dbSession, Collection<String> logins,
        String organizationUuid) {
    Multimap<String, String> result = ArrayListMultimap.create();
    executeLargeInputs(logins, input -> {
        List<LoginGroup> groupMemberships = mapper(dbSession).selectGroupsByLoginsAndOrganization(input,
                organizationUuid);//www . j a va  2 s.co m
        for (LoginGroup membership : groupMemberships) {
            result.put(membership.login(), membership.groupName());
        }
        return groupMemberships;
    });

    return result.keys();
}

From source file:forestry.core.items.ItemElectronTube.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override/*from w ww.  java 2 s . c  o m*/
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) {

    Multimap<ICircuitLayout, ICircuit> circuits = ArrayListMultimap.create();
    for (ICircuitLayout circuitLayout : ChipsetManager.circuitRegistry.getRegisteredLayouts().values()) {
        ICircuit circuit = ItemSolderingIron.SolderManager.getCircuit(circuitLayout, itemstack);
        if (circuit != null) {
            circuits.put(circuitLayout, circuit);
        }
    }

    if (circuits.size() > 0) {
        if (Proxies.common.isShiftDown()) {
            for (ICircuitLayout circuitLayout : circuits.keys()) {
                String circuitLayoutName = circuitLayout.getUsage();
                list.add(
                        EnumChatFormatting.WHITE.toString() + EnumChatFormatting.UNDERLINE + circuitLayoutName);
                for (ICircuit circuit : circuits.get(circuitLayout)) {
                    circuit.addTooltip(list);
                }
            }
        } else {
            list.add(EnumChatFormatting.ITALIC + "<" + StringUtil.localize("gui.tooltip.tmi") + ">");
        }
    } else {
        list.add("<" + StringUtil.localize("gui.noeffect") + ">");
    }
}

From source file:blackboard.plugin.hayabusa.provider.ModuleItemProvider.java

@Override
public Iterable<Command> getCommands() {
    try {/*from   www .  ja  v a 2  s . c om*/
        // TODO wire these dependencies as fields/constructor inject
        ModuleDbLoader moduleLoader = ModuleDbLoader.Default.getInstance();
        NavigationItemDbLoader niLoader = NavigationItemDbLoader.Default.getInstance();

        Multimap<Module, NavigationItemControl> nicByModule = ArrayListMultimap.create();
        for (Module module : moduleLoader.heavyLoadByModuleType("bb/admin")) {
            String subgroup = module.getPortalExtraInfo().getExtraInfo().getValue("subgroup");
            List<NavigationItemControl> nics = NavigationItemControl
                    .createList(niLoader.loadBySubgroup(subgroup));
            nicByModule.putAll(module, nics);
        }

        Set<Command> commands = Sets.newTreeSet();
        for (Module module : nicByModule.keys()) {
            Collection<NavigationItemControl> nics = nicByModule.get(module);
            for (NavigationItemControl nic : nics) {
                if (!nic.userHasAccess()) {
                    continue;
                }
                String title = String.format("%s: %s", module.getTitle(), nic.getLabel());
                String url = FramesetUtil.getTabGroupUrl(blackboard.data.navigation.Tab.TabType.admin,
                        nic.getUrl());
                commands.add(new SimpleCommand(title, url, Category.SYSTEM_ADMIN));
            }
        }
        return commands;
    } catch (PersistenceException e) {
        throw new PersistenceRuntimeException(e);
    }
}

From source file:com.taobao.android.builder.tasks.app.prepare.PrepareSoLibTask.java

/**
 * ?so//from  w  w w . j  a  va 2s.  c  o m
 */
@TaskAction
void generate() {
    List<File> scanDirs = new ArrayList<File>();
    //?bundlejnifolder
    if (!getMainBundleOutputFolder().exists()) {
        getMainBundleOutputFolder().mkdirs();
    }

    for (File jniFolder : getJniFolders()) {
        if (jniFolder.exists() && jniFolder.isDirectory()) {
            NativeSoUtils.copyLocalNativeLibraries(jniFolder, getMainBundleOutputFolder(), getSupportAbis(),
                    getRemoveSoFiles(), getILogger());
        }
    }

    scanDirs.add(getMainBundleOutputFolder());

    //bundle?solibso
    for (SoLibrary mainSoLib : getMainDexSoLibraries()) {
        File explodeFolder = mainSoLib.getFolder();
        if (explodeFolder.exists() && explodeFolder.isDirectory()) {
            NativeSoUtils.copyLocalNativeLibraries(explodeFolder, getMainBundleOutputFolder(), getSupportAbis(),
                    getRemoveSoFiles(), getILogger());
        }
    }

    //?awb bundleso
    for (AwbBundle awbLib : getAwbLibs()) {
        File awbOutputFolder = new File(appVariantOutputContext.getAwbJniFolder(awbLib), "lib");
        awbOutputFolder.mkdirs();
        scanDirs.add(awbOutputFolder);
        File awbJniFolder = awbLib.getJniFolder();
        if (awbJniFolder.exists() && awbJniFolder.isDirectory()) {
            NativeSoUtils.copyLocalNativeLibraries(awbJniFolder, awbOutputFolder, getSupportAbis(),
                    getRemoveSoFiles(), getILogger());
        }
        //??aarawb?
        File libJniFolder = new File(awbLib.getFolder(), "libs");
        if (libJniFolder.exists() && libJniFolder.isDirectory()) {
            NativeSoUtils.copyLocalNativeLibraries(libJniFolder, awbOutputFolder, getSupportAbis(),
                    getRemoveSoFiles(), getILogger());
        }
        List<? extends AndroidLibrary> deps = awbLib.getLibraryDependencies();
        for (AndroidLibrary dep : deps) {
            File depJniFolder = dep.getJniFolder();
            if (depJniFolder.exists() && depJniFolder.isDirectory()) {
                NativeSoUtils.copyLocalNativeLibraries(depJniFolder, awbOutputFolder, getSupportAbis(),
                        getRemoveSoFiles(), getILogger());
            }
            //??aarawb?
            File depLibsFolder = new File(dep.getFolder(), "libs");
            if (depLibsFolder.exists() && depLibsFolder.isDirectory()) {
                NativeSoUtils.copyLocalNativeLibraries(depLibsFolder, awbOutputFolder, getSupportAbis(),
                        getRemoveSoFiles(), getILogger());
            }
        }

        List<SoLibrary> solibs = awbLib.getSoLibraries();
        if (null != solibs) {
            for (SoLibrary solib : solibs) {
                File explodeFolder = solib.getFolder();
                if (explodeFolder.exists() && explodeFolder.isDirectory()) {
                    NativeSoUtils.copyLocalNativeLibraries(explodeFolder, awbOutputFolder, getSupportAbis(),
                            getRemoveSoFiles(), getILogger());
                }
            }
        }
    }
    //???so
    // ??
    Map<String, Multimap<String, File>> soMaps = NativeSoUtils.getAbiSoFiles(getSupportAbis(),
            getRemoveSoFiles(), scanDirs);
    boolean hasDup = false;
    for (Map.Entry<String, Multimap<String, File>> entry : soMaps.entrySet()) {
        String abi = entry.getKey();
        Multimap<String, File> soFiles = soMaps.get(abi);
        for (String soKey : soFiles.keys()) {
            if (soFiles.get(soKey).size() > 1) {
                getILogger()
                        .warning("[SO Duplicate][" + abi + "]:" + StringUtils.join(soFiles.get(soKey), ","));
                hasDup = true;
            } else {
                getILogger().verbose("[SO][" + abi + "]:" + StringUtils.join(soFiles.get(soKey), ","));
            }
        }
    }

    //        if (hasDup && getFailOnDuplicateSo()) {
    //            throw new RuntimeException("SO file has duplicate files!See detail info!");
    //        }
}

From source file:com.taobao.android.builder.tasks.app.merge.MergeSoLibTask.java

/**
 * ?so//from  w w w  .j  a v  a  2s  .c o m
 */
@TaskAction
void generate() {
    List<File> scanDirs = new ArrayList<File>();
    //?bundlejnifolder
    if (!getMainBundleOutputFolder().exists()) {
        getMainBundleOutputFolder().mkdirs();
    }

    for (File jniFolder : getJniFolders()) {
        if (jniFolder.exists() && jniFolder.isDirectory()) {
            NativeSoUtils.copyLocalNativeLibraries(jniFolder, getMainBundleOutputFolder(), getSupportAbis(),
                    getRemoveSoFiles());
        }
    }

    scanDirs.add(getMainBundleOutputFolder());

    //bundle?solibso
    for (SoLibrary mainSoLib : getMainDexSoLibraries()) {
        File explodeFolder = mainSoLib.getFolder();
        if (explodeFolder.exists() && explodeFolder.isDirectory()) {
            NativeSoUtils.copyLocalNativeLibraries(explodeFolder, getMainBundleOutputFolder(), getSupportAbis(),
                    getRemoveSoFiles());
        }
    }

    //?awb bundleso
    for (AwbBundle awbLib : getAwbLibs()) {
        File awbOutputFolder = new File(appVariantOutputContext.getAwbJniFolder(awbLib), "lib");
        awbOutputFolder.mkdirs();
        scanDirs.add(awbOutputFolder);
        File awbJniFolder = awbLib.getAndroidLibrary().getJniFolder();
        if (awbJniFolder.exists() && awbJniFolder.isDirectory()) {
            NativeSoUtils.copyLocalNativeLibraries(awbJniFolder, awbOutputFolder, getSupportAbis(),
                    getRemoveSoFiles());
        }
        //??aarawb?
        File libJniFolder = new File(awbLib.getAndroidLibrary().getFolder(), "libs");
        if (libJniFolder.exists() && libJniFolder.isDirectory()) {
            NativeSoUtils.copyLocalNativeLibraries(libJniFolder, awbOutputFolder, getSupportAbis(),
                    getRemoveSoFiles());
        }
        List<? extends AndroidLibrary> deps = awbLib.getAndroidLibraries();
        for (AndroidLibrary dep : deps) {
            File depJniFolder = dep.getJniFolder();
            if (depJniFolder.exists() && depJniFolder.isDirectory()) {
                NativeSoUtils.copyLocalNativeLibraries(depJniFolder, awbOutputFolder, getSupportAbis(),
                        getRemoveSoFiles());
            }
            //??aarawb?
            File depLibsFolder = new File(dep.getFolder(), "libs");
            if (depLibsFolder.exists() && depLibsFolder.isDirectory()) {
                NativeSoUtils.copyLocalNativeLibraries(depLibsFolder, awbOutputFolder, getSupportAbis(),
                        getRemoveSoFiles());
            }
        }

        List<SoLibrary> solibs = awbLib.getSoLibraries();
        if (null != solibs) {
            for (SoLibrary solib : solibs) {
                File explodeFolder = solib.getFolder();
                if (explodeFolder.exists() && explodeFolder.isDirectory()) {
                    NativeSoUtils.copyLocalNativeLibraries(explodeFolder, awbOutputFolder, getSupportAbis(),
                            getRemoveSoFiles());
                }
            }
        }
    }
    //???so
    // ??
    Map<String, Multimap<String, File>> soMaps = NativeSoUtils.getAbiSoFiles(getSupportAbis(),
            getRemoveSoFiles(), scanDirs);
    boolean hasDup = false;
    for (Map.Entry<String, Multimap<String, File>> entry : soMaps.entrySet()) {
        String abi = entry.getKey();
        Multimap<String, File> soFiles = soMaps.get(abi);
        for (String soKey : soFiles.keys()) {
            if (soFiles.get(soKey).size() > 1) {
                getILogger()
                        .warning("[SO Duplicate][" + abi + "]:" + StringUtils.join(soFiles.get(soKey), ","));
                hasDup = true;
            } else {
                getILogger().verbose("[SO][" + abi + "]:" + StringUtils.join(soFiles.get(soKey), ","));
            }
        }
    }

    //        if (hasDup && getFailOnDuplicateSo()) {
    //            throw new RuntimeException("SO file has duplicate files!See detail info!");
    //        }
}

From source file:com.mrd.bitlib.StandardTransactionBuilder.java

private Address extractRichest(Multimap<Address, UnspentTransactionOutput> index) {
    Address ret = null;//from ww  w.j  ava 2 s .  com
    long maxSum = 0;
    for (Address address : index.keys()) {
        Collection<UnspentTransactionOutput> unspentTransactionOutputs = index.get(address);
        long newSum = sum(unspentTransactionOutputs);
        if (newSum > maxSum) {
            ret = address;
        }
        maxSum = newSum;
    }
    return ret;
}

From source file:io.nuun.kernel.core.internal.scanner.disk.ClasspathScannerDisk.java

@Override
public void scanClasspathForMetaAnnotation(final Class<? extends Annotation> annotationType,
        final Callback callback) {
    //        ConfigurationBuilder configurationBuilder = configurationBuilder();
    //        Set<URL> computeUrls = computeUrls();
    //        Reflections reflections = new Reflections(configurationBuilder.addUrls(computeUrls).setScanners(new TypesScanner()));

    queue(new ScannerCommand() {
        @Override/*from w  ww . j  a  v a 2  s.co  m*/
        public void execute(Reflections reflections) {
            Multimap<String, String> multimap = reflections.getStore().get(TypesScanner.class);
            Collection<Class<?>> typesAnnotatedWith = Sets.newHashSet();
            for (String className : multimap.keys()) {
                Class<?> klass = toClass(className);
                if (annotationType != null && klass != null
                        && AssertUtils.hasAnnotationDeep(klass, annotationType) && !klass.isAnnotation()) {
                    typesAnnotatedWith.add(klass);
                }
            }
            callback.callback(postTreatment(typesAnnotatedWith));
        }

        @Override
        public Scanner scanner() {
            return new TypesScanner();
        }

    });

}