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:eu.cloudwave.wp5.common.dto.model.AnnotationDto.java

public AnnotationDto() {
    this(null, Maps.newHashMap());
}

From source file:ee.ellytr.chat.LocaleRegistry.java

public LocaleRegistry() {
    localeFiles = Maps.newHashMap();
    factory = new LocaleFactory(this);

    addDefaultLocaleFiles();
}

From source file:flipkart.mongo.node.discovery.utils.DiscoveryUtils.java

/**
 * assign hashcode to replicaSet, which will be used for comparing two replicaSets
 * @param replicaSetConfigs/*ww  w .j  a va  2s. co  m*/
 * @return
 */
private static Map<Integer, ReplicaSetConfig> getHashForReplicaSets(List<ReplicaSetConfig> replicaSetConfigs) {

    Map<Integer, ReplicaSetConfig> rsConfigMap = Maps.newHashMap();

    for (ReplicaSetConfig rsConfig : replicaSetConfigs) {
        rsConfigMap.put(rsConfig.hashCode(), rsConfig);
    }
    return rsConfigMap;
}

From source file:com.prealpha.minelib.nbt.CompoundTag.java

public CompoundTag() {
    value = Maps.newHashMap();
}

From source file:com.doctusoft.bean.Properties.java

/**
 * Creates a {@link HashMap} of the element attributes, using the keyAttribute and valueAttribute to extract keys and values. 
 *//*w  w w. j a  v a  2 s. co  m*/
public static <T, Key, Value> Map<Key, Value> map(Iterable<T> elements, Property<? super T, Key> keyAttribute,
        Property<? super T, Value> valueAttribute) {
    // I didn't find a way to do this properly with standard Guava methods
    Map<Key, Value> result = Maps.newHashMap();
    for (T element : elements) {
        result.put(keyAttribute.getValue(element), valueAttribute.getValue(element));
    }
    return result;
}

From source file:burp.BurpExtender.java

public BurpExtender() {
    this.hostVulnerabilityMap = Maps.newHashMap();
}

From source file:org.mayocat.shop.catalog.configuration.ProductTypesEntityConfigurationContributor.java

@Override
public void contribute(Map<String, Object> configuration) {
    if (!configuration.containsKey("types")) {
        configuration.put("types", Maps.newHashMap());
    }/* w  ww . j  a va 2 s.com*/
    ((Map<String, TypeDefinition>) configuration.get("types"))
            .putAll(catalogSettings.getProductsSettings().getTypes());
}

From source file:com.cloudera.crunch.impl.mem.collect.MemGroupedTable.java

private static <S, T> Map<S, Collection<T>> createMapFor(PType<S> keyType, GroupingOptions options,
        Pipeline pipeline) {/* w w  w.  j  a  v  a2  s .com*/
    if (options != null && options.getSortComparatorClass() != null) {
        RawComparator<S> rc = ReflectionUtils.newInstance(options.getSortComparatorClass(),
                pipeline.getConfiguration());
        return new TreeMap<S, Collection<T>>(rc);
    } else if (keyType != null && Comparable.class.isAssignableFrom(keyType.getTypeClass())) {
        return new TreeMap<S, Collection<T>>();
    }
    return Maps.newHashMap();
}

From source file:io.pcp.parfait.pcp.StringParsingTextSource.java

private Map<String, String> parseMap(Iterable<String> input) {
    Map<String, String> output = Maps.newHashMap();
    int lineNumber = 0;
    for (String currentLine : input) {
        lineNumber++;//from  w w  w  . ja  va  2s . c  o m
        if (!(currentLine.trim().isEmpty() || currentLine.trim().startsWith("#"))) {
            String[] elements = currentLine.trim().split("\t");
            if (elements.length != 2) {
                throw new IllegalArgumentException("Error parsing line " + lineNumber
                        + " of input; should have two tab-delimited columns in format <name>\\t<text>");
            }
            String metricName = elements[0];
            String text = elements[1];

            output.put(metricName, text);
        }
    }
    return output;
}

From source file:org.apache.drill.exec.schema.DataRecord.java

public DataRecord() {
    this.dataMap = Maps.newHashMap();
}