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.yufei.analysis.service.impl.WordsOperation.java

@Override
public void removeTerm(long id) {
    Map<String, Object> paras = Maps.newHashMap();
    paras.put("_id=", id);
    Constants.mps.removeAll(paras, Term.class);

}

From source file:com.yuga.ygplatform.modules.sys.utils.DictUtils.java

public static List<Dict> getDictList(String type) {
    @SuppressWarnings("unchecked")
    Map<String, List<Dict>> dictMap = Maps.newHashMap();
    for (Dict dict : dictDao.findAllList()) {
        List<Dict> dictList = dictMap.get(dict.getType());
        if (dictList != null) {
            dictList.add(dict);/*from  ww w  . j a v  a  2s  .  c o m*/
        } else {
            dictMap.put(dict.getType(), Lists.newArrayList(dict));
        }
    }
    List<Dict> dictList = Lists.newArrayList();
    if (dictList != null) {
        dictList = dictMap.get(type);
    }
    return dictList;
}

From source file:org.axdt.swc.ui.model.SwcContainer.java

public SwcContainer(SwcContainer parent, String name) {
    super(parent, name);
    containers = Maps.newHashMap();
    entries = Maps.newHashMap();
}

From source file:com.google.gapid.widgets.CopySources.java

public static void registerTreeAsCopySource(CopyPaste cp, TreeViewer tree, ColumnTextProvider columnProvider) {
    cp.registerCopySource(tree.getControl(), new CopySource() {
        @Override//from   ww w.j  a  va  2s  . c o m
        public boolean hasCopyData() {
            return !tree.getSelection().isEmpty();
        }

        @Override
        public CopyData[] getCopyData() {
            // Create rows from all the paths.
            List<Node> roots = Lists.newArrayList();
            Map<TreePath, Node> pathToNode = Maps.newHashMap();
            for (TreePath path : tree.getStructuredSelection().getPaths()) {
                createNode(path, columnProvider, pathToNode, roots);
            }

            // Measure the column widths.
            List<Integer> maxColumnWidths = new ArrayList<>(2);
            for (Node node : roots) {
                node.measure(maxColumnWidths, 0);
            }

            // Print each of the roots and their children.
            StringBuffer plainBuf = new StringBuffer();
            for (Node node : roots) {
                node.print(plainBuf, maxColumnWidths);
            }

            return new CopyData[] { CopyData.text(plainBuf.toString()) };
        }
    });
    tree.addSelectionChangedListener(e -> cp.updateCopyState());
}

From source file:org.sonatype.nexus.internal.log.LogbackOverrides.java

/**
 * Reads loggers/levels from logback-overrides.xml.
 *///from   w w  w.  j a  va2  s .  c o m
static Map<String, LoggerLevel> read(final File overridesXml) {
    try {
        final Map<String, LoggerLevel> loggers = Maps.newHashMap();

        SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setValidating(false);
        spf.setNamespaceAware(true);
        spf.newSAXParser().parse(overridesXml, new DefaultHandler() {
            @Override
            public void startElement(final String uri, final String localName, final String qName,
                    final Attributes attributes) throws SAXException {
                if ("logger".equals(localName)) {
                    String name = attributes.getValue("name");
                    String level = attributes.getValue("level");
                    loggers.put(name, LoggerLevel.valueOf(level));
                }
            }
        });
        return loggers;
    } catch (Exception e) {
        // TODO shall we just log and continue?
        throw Throwables.propagate(e);
    }
}

From source file:com.github.lburgazzoli.hazelcast.HzServiceDefinition.java

public HzServiceDefinition() {
    m_attributes = Maps.newHashMap();
}

From source file:org.eclipse.xtext.graphview.shape.ColorMemento.java

public ColorMemento(IFigure parent) {
    fgColors = Maps.newHashMap();
    bgColors = Maps.newHashMap();
    addFigure(parent);
}

From source file:com.enonic.cms.core.xslt.portal.ParamTypeExtractor.java

private ParamTypeExtractor(final Controller xsl) {
    this.xsl = xsl;
    this.namePool = this.xsl.getNamePool();
    this.map = Maps.newHashMap();
    doExtract();/*from  ww  w .j  a  v a  2s.co  m*/
}

From source file:terasort.utils.Utils.java

public static Map<String, LocalResource> getLocalResources(List<Class> classList, TezConfiguration tezConf)
        throws IOException, URISyntaxException {
    Map<String, LocalResource> localResources = Maps.newHashMap();
    Path stagingDir = TezCommonUtils.getTezBaseStagingPath(tezConf);

    // staging dir
    FileSystem fs = FileSystem.get(tezConf);
    String uuid = UUID.randomUUID().toString();
    Path jobJar = new Path(stagingDir, uuid + "_job.jar");
    if (fs.exists(jobJar)) {
        fs.delete(jobJar, false);//from w w w .j a v a  2  s.c om
    }

    for (Class clazz : classList) {
        Path path = getCurrentJarURL(clazz);
        fs.copyFromLocalFile(path, jobJar);
        System.out.println("Path : " + path);
    }

    localResources.put(uuid + "_job.jar", createLocalResource(fs, jobJar));
    return localResources;
}

From source file:grakn.core.graql.gremlin.spanningtree.graph.DenseWeightedGraph.java

public static DenseWeightedGraph from(Iterable<Node> nodes, double[][] weights) {
    final ArrayList<Node> nodeList = Lists.newArrayList(nodes);
    Preconditions.checkArgument(nodeList.size() == weights.length);
    final Map<Node, Integer> indexOf = Maps.newHashMap();
    for (int i = 0; i < nodeList.size(); i++) {
        indexOf.put(nodeList.get(i), i);
    }/*from w  w  w. j  a  va  2s  . co m*/
    return new DenseWeightedGraph(nodeList, indexOf, weights);
}