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.facebook.buck.apple.xcode.plist.PlistDictionary.java

public PlistDictionary() {
    this.value = Maps.newHashMap();
}

From source file:com.google.idea.blaze.java.sync.projectstructure.SourceFolderEditor.java

public static void modifyContentEntries(BlazeJavaImportResult importResult,
        Collection<ContentEntry> contentEntries) {

    Map<File, BlazeContentEntry> contentEntryMap = Maps.newHashMap();
    for (BlazeContentEntry contentEntry : importResult.contentEntries) {
        contentEntryMap.put(contentEntry.contentRoot, contentEntry);
    }/*www  .j  a  va 2 s . co  m*/

    for (ContentEntry contentEntry : contentEntries) {
        VirtualFile virtualFile = contentEntry.getFile();
        if (virtualFile == null) {
            continue;
        }

        File contentRoot = new File(virtualFile.getPath());
        BlazeContentEntry javaContentEntry = contentEntryMap.get(contentRoot);
        if (javaContentEntry != null) {
            for (BlazeSourceDirectory sourceDirectory : javaContentEntry.sources) {
                addSourceFolderToContentEntry(contentEntry, sourceDirectory);
            }
        }
    }
}

From source file:ch.aonyx.broker.ib.api.RequestBiMapService.java

RequestBiMapService() {
    idRequestMap = Maps.newHashMap();
}

From source file:org.apache.tajo.engine.utils.TupleUtil.java

/**
 * if max value is null, set ranges[last]
 * @param sortSpecs/*from www. j a va2 s . c o m*/
 * @param sortSchema
 * @param colStats
 * @param ranges
 */
public static void setMaxRangeIfNull(SortSpec[] sortSpecs, Schema sortSchema, List<ColumnStats> colStats,
        TupleRange[] ranges) {
    Map<Column, ColumnStats> statMap = Maps.newHashMap();
    for (ColumnStats stat : colStats) {
        statMap.put(stat.getColumn(), stat);
    }

    int i = 0;
    for (Column col : sortSchema.getRootColumns()) {
        ColumnStats columnStat = statMap.get(col);
        if (columnStat == null) {
            continue;
        }
        if (columnStat.hasNullValue()) {
            if (sortSpecs[i].isNullsFirst()) {
                Tuple rangeTuple = ranges[0].getStart();
                rangeTuple.put(i, NullDatum.get());
            } else {
                Tuple rangeTuple = ranges[ranges.length - 1].getEnd();
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Set null into range: " + col.getQualifiedName() + ", previous tuple is "
                            + rangeTuple);
                }
                rangeTuple.put(i, NullDatum.get());
                LOG.info("Set null into range: " + col.getQualifiedName() + ", current tuple is " + rangeTuple);
            }
        }
        i++;
    }
}

From source file:cc.recommenders.usages.ProjectFoldingIndex.java

public void setCount(ICoReTypeName type, String projectName, int num) {
    Map<String, Integer> counts = index.get(type);
    if (counts == null) {
        counts = Maps.newHashMap();
        index.put(type, counts);/*from ww w  . j  av  a  2s.  c  om*/
    }
    counts.put(projectName, num);
}

From source file:gobblin.data.management.conversion.hive.mock.MockUpdateProvider.java

private MockUpdateProvider() {
    this.mock_updates_map = Maps.newHashMap();
}

From source file:org.eclipse.mylyn.internal.wikitext.html.core.SpanStrategies.java

private static Map<SpanType, List<SpanType>> createSpanTypeToAlternatives() {
    Map<SpanType, List<SpanType>> alternatives = Maps.newHashMap();
    addAlternatives(alternatives, SpanType.BOLD, SpanType.STRONG);
    addAlternatives(alternatives, SpanType.STRONG, SpanType.BOLD);
    addAlternatives(alternatives, SpanType.CODE, SpanType.MONOSPACE);
    addAlternatives(alternatives, SpanType.EMPHASIS, SpanType.ITALIC);
    addAlternatives(alternatives, SpanType.INSERTED, SpanType.UNDERLINED);
    addAlternatives(alternatives, SpanType.ITALIC, SpanType.EMPHASIS);
    addAlternatives(alternatives, SpanType.MONOSPACE, SpanType.CODE);
    return ImmutableMap.copyOf(alternatives);
}

From source file:edu.byu.nlp.util.DoubleArrays.java

/**
 * @returns null if arr is of size 0; otherwise 
 * the indices of the top n elements descending value order  
 *//*from ww w.  j a va 2s.  co  m*/
public static List<Integer> argMaxList(int topn, final double arr[]) {
    if (arr == null || arr.length == 0) {
        return null;
    }
    Map<Integer, Double> map = Maps.newHashMap();
    for (int i = 0; i < arr.length; i++) {
        map.put(i, arr[i]);
    }
    return Counters.argMaxList(map.entrySet(), topn, null);
}

From source file:org.apache.hadoop.hdfs.protocolPB.ReconfigurationProtocolUtils.java

public static ReconfigurationTaskStatus getReconfigurationStatus(
        GetReconfigurationStatusResponseProto response) {
    Map<PropertyChange, Optional<String>> statusMap = null;
    long startTime;
    long endTime = 0;

    startTime = response.getStartTime();
    if (response.hasEndTime()) {
        endTime = response.getEndTime();
    }/*from   w  ww  . j  a v  a 2  s . c o  m*/
    if (response.getChangesCount() > 0) {
        statusMap = Maps.newHashMap();
        for (GetReconfigurationStatusConfigChangeProto change : response.getChangesList()) {
            PropertyChange pc = new PropertyChange(change.getName(), change.getNewValue(),
                    change.getOldValue());
            String errorMessage = null;
            if (change.hasErrorMessage()) {
                errorMessage = change.getErrorMessage();
            }
            statusMap.put(pc, Optional.fromNullable(errorMessage));
        }
    }
    return new ReconfigurationTaskStatus(startTime, endTime, statusMap);
}

From source file:com.zaradai.kunzite.trader.orders.book.DefaultOrderBook.java

@Override
protected Map<String, Order> createOrderMap() {
    return Maps.newHashMap();
}