Example usage for com.google.common.collect Maps newHashMap

List of usage examples for com.google.common.collect Maps newHashMap

Introduction

In this page you can find the example usage for com.google.common.collect Maps newHashMap.

Prototype

public static <K, V> HashMap<K, V> newHashMap() 

Source Link

Document

Creates a mutable, empty HashMap instance.

Usage

From source file:com.enonic.cms.upgrade.task.datasource.method.DataSourceMethodConverters.java

public DataSourceMethodConverters() {
    this.map = Maps.newHashMap();
    add(new GetLocalesConverter());
    add(new GetTimeZonesConverter());
    add(new GetPreferencesConverter());
    add(new GetUserStoreConverter());
    add(new GetCountriesConverter());
    add(new GetCalendarConverter());
    add(new GetContentVersionConverter());
    add(new GetUrlAsTextConverter());
    add(new GetUrlAsXmlConverter());
    add(new GetFormattedDateConverter());
    add(new GetIndexValuesConverter());
    add(new GetAggregatedIndexValuesConverter());
    add(new GetMenuConverter());
    add(new GetMenuDataConverter());
    add(new GetMenuItemConverter());
    add(new GetSubMenuConverter());
    add(new GetMenuBranchConverter());
    add(new GetSuperCategoryNamesConverter());
    add(new GetContentByQueryConverter());
    add(new GetRelatedContentConverter());
    add(new GetRandomContentBySectionConverter());
    add(new GetRandomContentByCategoryConverter());
    add(new GetContentByCategoryConverter());
    add(new GetContentBySectionConverter());
    add(new GetContentConverter());
    add(new GetRelatedContentsConverter());
    add(new GetCategoriesConverter());
    add(new FindContentByCategoryConverter());
    add(new GetMyContentByCategoryConverter());
}

From source file:org.sonar.duplications.algorithm.filter.IntervalTreeClonePairFilter.java

private static Map<String, IntervalTree> buildTrees(List<ClonePair> clones) {
    Map<String, IntervalTree> trees = Maps.newHashMap();

    //populate interval tree structure
    for (ClonePair clonePair : clones) {
        String originResourceId = clonePair.getOriginPart().getResourceId();
        String otherResourceId = clonePair.getAnotherPart().getResourceId();
        IntervalTree tree = trees.get(otherResourceId);
        if (tree == null) {
            tree = new IntervalTree();
            trees.put(otherResourceId, tree);
        }/*ww  w . j a v  a  2s.  c  o  m*/
        List<ClonePart> parts = clonePair.getCloneParts();
        for (ClonePart part : parts) {
            if (part.getResourceId().equals(originResourceId)) {
                PartWrapper partWrap = new PartWrapper(clonePair, part);
                int unitStart = part.getUnitStart();
                int unitEnd = part.getUnitStart() + clonePair.getCloneUnitLength() - 1;

                tree.addInterval(new Interval(unitStart, unitEnd, partWrap));
            }
        }
    }

    return trees;
}

From source file:org.apache.isis.viewer.restfulobjects.rendering.util.GraphUtil.java

public final static Map<PathNode, Map> asGraph(final List<List<String>> links) {
    if (links == null) {
        return Collections.emptyMap();
    }/*w  w  w . java 2s.c o  m*/
    final Map<PathNode, Map> map = Maps.newHashMap();
    for (final List<String> link : links) {
        GraphUtil.mergeInto(link, map);
    }
    return map;
}

From source file:com.enonic.cms.framework.util.TIntIntHashMap.java

public TIntIntHashMap() {
    this.map = Maps.newHashMap();
}

From source file:org.apache.drill.exec.server.options.FragmentOptionManager.java

private static Map<String, OptionValue> getMapFromOptionList(OptionList options) {
    Map<String, OptionValue> tmp = Maps.newHashMap();
    for (OptionValue v : options) {
        tmp.put(v.name, v);/*from  w  ww .  ja  va2 s. co m*/
    }
    return ImmutableMap.copyOf(tmp);
}

From source file:com.enonic.cms.framework.util.TIntObjectHashMap.java

public TIntObjectHashMap() {
    this.map = Maps.newHashMap();
}

From source file:org.glowroot.plugin.servlet.HttpSessions.java

static ImmutableMap<String, String> getSessionAttributes(HttpSession session) {
    Set<String> capturePaths = ServletPluginProperties.captureSessionAttributePaths();
    if (capturePaths.isEmpty()) {
        return ImmutableMap.of();
    }//from   www  .j a  v  a2  s .  c om
    Map<String, String> captureMap = Maps.newHashMap();
    // dump only http session attributes in list
    for (String capturePath : capturePaths) {
        if (capturePath.equals("*")) {
            captureAllSessionAttributes(session, captureMap);
        } else if (capturePath.endsWith(".*")) {
            captureWildcardPath(session, captureMap, capturePath.substring(0, capturePath.length() - 2));
        } else {
            captureNonWildcardPath(session, captureMap, capturePath);
        }
    }
    return ImmutableMap.copyOf(captureMap);
}

From source file:com.shopwiki.roger.rpc.RpcResponse.java

public static Map<String, String> getHeaders(BasicProperties props) {
    Map<String, Object> headers = props.getHeaders();
    if (headers == null) {
        return Collections.emptyMap();
    }// w w w.j  ava  2 s  .  c o  m

    Map<String, String> map = Maps.newHashMap();
    for (Map.Entry<String, Object> entry : headers.entrySet()) {
        map.put(entry.getKey(), String.valueOf(entry.getValue()));
    }
    return map;
}

From source file:org.apache.druid.indexer.TaskMetricsUtils.java

public static Map<String, Object> makeIngestionRowMetrics(long rowsProcessed, long rowsProcessedWithErrors,
        long rowsUnparseable, long rowsThrownAway) {
    Map<String, Object> metricsMap = Maps.newHashMap();
    metricsMap.put(ROWS_PROCESSED, rowsProcessed);
    metricsMap.put(ROWS_PROCESSED_WITH_ERRORS, rowsProcessedWithErrors);
    metricsMap.put(ROWS_UNPARSEABLE, rowsUnparseable);
    metricsMap.put(ROWS_THROWN_AWAY, rowsThrownAway);
    return metricsMap;
}

From source file:org.gradle.groovy.scripts.internal.RegistryAwareClassLoaderHierarchyHasher.java

private static Map<ClassLoader, String> collectKnownClassLoaders(ClassLoaderRegistry registry) {
    Map<ClassLoader, String> knownClassLoaders = Maps.newHashMap();

    String javaVmVersion = String.format("%s|%s|%s", System.getProperty("java.vm.name"),
            System.getProperty("java.vm.vendor"), System.getProperty("java.vm.vendor"));
    ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
    if (systemClassLoader != null) {
        addClassLoader(knownClassLoaders, systemClassLoader, "system-app" + javaVmVersion);
        addClassLoader(knownClassLoaders, systemClassLoader.getParent(), "system-ext" + javaVmVersion);
    }/*from w ww .j  ava  2s. co m*/

    String gradleVersion = GradleVersion.current().getVersion();
    addClassLoader(knownClassLoaders, registry.getRuntimeClassLoader(), "runtime:" + gradleVersion);
    addClassLoader(knownClassLoaders, registry.getGradleApiClassLoader(), "gradle-api:" + gradleVersion);
    addClassLoader(knownClassLoaders, registry.getGradleCoreApiClassLoader(),
            "gradle-core-api:" + gradleVersion);
    addClassLoader(knownClassLoaders, registry.getPluginsClassLoader(), "plugins:" + gradleVersion);

    return knownClassLoaders;
}