Example usage for com.google.common.collect ArrayListMultimap create

List of usage examples for com.google.common.collect ArrayListMultimap create

Introduction

In this page you can find the example usage for com.google.common.collect ArrayListMultimap create.

Prototype

public static <K, V> ArrayListMultimap<K, V> create() 

Source Link

Document

Creates a new, empty ArrayListMultimap with the default initial capacities.

Usage

From source file:org.deephacks.confit.internal.hbase.HBeanPredecessors.java

public static Multimap<byte[], byte[]> getPredecessors(Multimap<String, String> predecessors,
        final UniqueIds uids) {
    final Multimap<byte[], byte[]> bytes = ArrayListMultimap.create();

    for (String schemaName : predecessors.keySet()) {
        final byte[] sid = uids.getUsid().getId(schemaName);
        Collection<String> ids = predecessors.get(schemaName);
        bytes.put(sid, HBeanReferences.getIids(new ArrayList<String>(ids), uids));
    }//w ww  .j a va  2  s . c o m
    return bytes;
}

From source file:org.sonar.server.user.index.UserResultSetIterator.java

static UserResultSetIterator create(DbClient dbClient, DbSession session, @Nullable List<String> logins) {
    try {//www .  j a  va  2 s.c o m
        String sql = createSql(logins);
        PreparedStatement stmt = dbClient.getMyBatis().newScrollingSelectStatement(session, sql);
        setParameters(stmt, logins);

        ListMultimap<String, String> organizationUuidsByLogin = ArrayListMultimap.create();
        if (logins == null) {
            dbClient.organizationMemberDao().selectAllForUserIndexing(session, organizationUuidsByLogin::put);
        } else {
            dbClient.organizationMemberDao().selectForUserIndexing(session, logins,
                    organizationUuidsByLogin::put);
        }

        return new UserResultSetIterator(stmt, organizationUuidsByLogin);
    } catch (SQLException e) {
        throw new IllegalStateException("Fail to prepare SQL request to select all users", e);
    }
}

From source file:org.gradle.tooling.internal.consumer.converters.BuildInvocationsConverter.java

private List<ConsumerProvidedTaskSelector> buildRecursively(GradleProject project) {
    Multimap<String, String> aggregatedTasks = ArrayListMultimap.create();

    collectTasks(project, aggregatedTasks);

    List<ConsumerProvidedTaskSelector> selectors = Lists.newArrayList();
    for (String selectorName : aggregatedTasks.keySet()) {
        SortedSet<String> selectorTasks = Sets.newTreeSet(new TaskNameComparator());
        selectorTasks.addAll(aggregatedTasks.get(selectorName));
        selectors.add(new ConsumerProvidedTaskSelector().setName(selectorName).setTaskNames(selectorTasks)
                .setDescription(project.getParent() != null
                        ? String.format("%s:%s task selector", project.getPath(), selectorName)
                        : String.format("%s task selector", selectorName))
                .setDisplayName(String.format("%s in %s and subprojects.", selectorName, project.getName())));
    }//  www  .  ja  v  a 2  s  .  co  m
    return selectors;
}

From source file:io.redlink.sdk.impl.analysis.model.Enhancements.java

Enhancements() {
    this.enhancements = ArrayListMultimap.create();
    this.entities = Maps.newLinkedHashMap();
    languages = Sets.newHashSet();
}

From source file:org.caleydo.data.importer.tcga.model.ClinicalMapping.java

/**
 * @param string/* w ww  .  j av  a2s .c o  m*/
 * @return
 */
private static ListMultimap<String, CategoryProperty<String>> parseProperties(String fileName) {
    try (InputStreamReader r = new InputStreamReader(
            ClinicalMapping.class.getResourceAsStream("/resources/" + fileName))) {
        List<String> lines = CharStreams.readLines(r);
        lines.remove(0);
        ListMultimap<String, CategoryProperty<String>> result = ArrayListMultimap.create();
        for (String line : lines) {
            String[] ls = line.split("\t");
            String key = ls[0];
            String name = ls[1];
            String label = ls.length > 2 ? ls[2] : name;
            Color color = ls.length > 3 ? new Color(ls[3]) : null;
            result.put(key, new CategoryProperty<String>(name, label, color));
        }
        return result;
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ImmutableListMultimap.of();
}

From source file:org.mule.module.extension.internal.config.ElementDescriptor.java

/**
 * Creates a new instance which describes an XML element
 * which state is represented by the passed arguments
 *
 * @param name       the name of the element
 * @param attributes a {@link Map} containing the element's attribute names and their values
 * @param childs     a {@link List} of other {@link ElementDescriptor} instances which represents this
 *                   element's childs. Can be empty but must not be {@code null}
 *///from   www  .jav a  2 s  .  c  o m
public ElementDescriptor(String name, Map<String, String> attributes, List<ElementDescriptor> childs) {
    this.name = name;
    this.attributes = attributes;
    this.childs = ArrayListMultimap.create();
    for (ElementDescriptor child : childs) {
        this.childs.put(child.getName(), child);
    }
}

From source file:nova.core.recipes.crafting.CraftingRecipeManager.java

public CraftingRecipeManager(RecipeManager recipeManager) {
    this.recipeManager = recipeManager;
    this.dynamicRecipes = new ArrayList<>();
    this.staticRecipes = ArrayListMultimap.create();

    recipeManager.whenRecipeAdded(CraftingRecipe.class, this::onCraftingRecipeAdded);
    recipeManager.whenRecipeRemoved(CraftingRecipe.class, this::onCraftingRecipeRemoved);
}

From source file:hudson.plugins.depgraph_view.model.graph.SubprojectCalculator.java

public ListMultimap<ProjectNode, ProjectNode> generate(DependencyGraph graph) {
    ListMultimap<ProjectNode, ProjectNode> project2Subprojects = ArrayListMultimap.create();
    Collection<ProjectNode> nodes = graph.getNodes();
    for (ProjectNode node : nodes) {
        for (SubProjectProvider provider : providers) {
            project2Subprojects.putAll(node, provider.getSubProjectsOf(node.getProject()));
        }/*from  w  w  w . j  av a 2 s.c  om*/
    }
    return project2Subprojects;
}

From source file:org.wso2.carbon.analytics.spark.core.util.SparkTableNamesHolder.java

public SparkTableNamesHolder(boolean isClustered) {
    this.isClustered = isClustered;
    if (isClustered) {
        HazelcastInstance hz = AnalyticsServiceHolder.getHazelcastInstance();
        this.sparkTableNames = hz.getMultiMap(AnalyticsConstants.TENANT_ID_AND_TABLES_MAP);
    } else {/* w w w .j a  va 2s . c  o m*/
        this.inMemSparkTableNames = ArrayListMultimap.create();
    }
}

From source file:uk.ac.cam.cl.dtg.picky.client.binding.EntryTreeBinding.java

@Override
protected CheckBoxTreeItem<String> doCompute() throws Exception {
    if (fileList != null && !fileList.isEmpty()) {
        ListMultimap<String, String> entrySelectionOptions = ArrayListMultimap.create();

        fileList.stream().flatMap(fileEntry -> fileEntry.getBlocks().stream())
                .flatMap(block -> block.getAttributes().entrySet().stream())
                .filter(e -> e.getValue() instanceof String)
                .forEach(e -> entrySelectionOptions.put(e.getKey(), (String) e.getValue()));
        return toTree(entrySelectionOptions);
    } else {/*from www. ja  va 2s  .c  o  m*/
        return null;
    }
}