List of usage examples for com.google.common.collect Maps newTreeMap
public static <K extends Comparable, V> TreeMap<K, V> newTreeMap()
From source file:org.locationtech.geogig.api.porcelain.InitOp.java
/** * Constructs a new {@code InitOp} with the specified parameters. * /* www . j av a 2 s . c om*/ * @param platform where to get the current directory from * @param context where to get the repository from (with auto-wired dependencies) once ensured * the {@code .geogig} repository directory is found or created. */ @Inject public InitOp(PluginDefaults defaults) { checkNotNull(defaults); this.defaults = defaults; this.config = Maps.newTreeMap(); }
From source file:nl.knaw.huygens.timbuctoo.model.ckcc.CKCCPerson.java
@Override public Map<String, String> getClientRepresentation() { Map<String, String> data = Maps.newTreeMap(); addItemToRepresentation(data, "urn", getUrn()); addItemToRepresentation(data, "cen", getCenUrn()); addItemToRepresentation(data, "notes", getNotes()); return data;//from ww w . ja v a 2 s . com }
From source file:org.eclipse.wb.internal.core.model.description.AbstractDescription.java
/** * Adds tags from given {@link AbstractDescription}. *//*w ww.j ava 2s .co m*/ public final void putTags(Map<String, String> tags) { if (tags != null && !tags.isEmpty()) { if (m_tags == null) { m_tags = Maps.newTreeMap(); } m_tags.putAll(tags); } }
From source file:com.google.gdt.eclipse.designer.gwtext.model.widgets.TabPanelInfo.java
/** * We ask elements for all components, but <code>TabPanel</code> renders component only when its * tab becomes visible. So, we should force rendering. *///from w w w.j av a2s . c om private void ensureTabsRendered() throws Exception { ClassLoader classLoader = JavaInfoUtils.getClassLoader(this); String script = CodeUtils.getSource("count = tabPanel.getItems().length;", "for (i = 0; i < count; i++) {", " tabPanel.setActiveTab(i);", "}"); Map<String, Object> variables = Maps.newTreeMap(); variables.put("tabPanel", getObject()); ScriptUtils.evaluate(classLoader, script, variables); }
From source file:rapture.series.mem.MemorySeriesStore.java
private SortedMap<String, SeriesValue> getOrMakeSeries(String key) { if (!seriesStore.containsKey(key)) { SortedMap<String, SeriesValue> data = Maps.newTreeMap(); seriesStore.put(key, data);//from ww w . j ava2 s. c o m childrenRepo.registerParentage(key); return data; } return seriesStore.get(key); }
From source file:ezbakehelpers.ezconfigurationhelpers.mongo.MongoConfigurationHelper.java
public String getMongoConnectionString() { StringBuilder builder = new StringBuilder("mongodb://"); // User credentials builder.append(getMongoDBUserName()).append(':').append(getMongoDBPassword()).append('@'); // Host names Map<String, Integer> hostPortMap = Maps.newTreeMap(); int mongoPort = getMongoDBPort(); for (String hostName : getMongoDBHostNames()) { hostPortMap.put(hostName, mongoPort); }//from w ww .j a v a 2s . com builder.append(Joiner.on(",").withKeyValueSeparator(":").join(hostPortMap)); // DatabaseName builder.append('/').append(getMongoDBDatabaseName()); // SSL builder.append("?ssl=").append(useMongoDBSSL()); return builder.toString(); }
From source file:org.jclouds.aws.s3.blobstore.strategy.internal.SequentialMultipartUploadStrategy.java
@Override public String execute(String container, Blob blob) { String key = blob.getMetadata().getName(); Payload payload = blob.getPayload(); Long length = payload.getContentMetadata().getContentLength(); checkNotNull(length,// w w w . j ava 2 s . com "please invoke payload.getContentMetadata().setContentLength(length) prior to multipart upload"); long chunkSize = algorithm.calculateChunkSize(length); int partCount = algorithm.getParts(); if (partCount > 0) { String uploadId = client.initiateMultipartUpload(container, ObjectMetadataBuilder.create().key(key).build()); try { SortedMap<Integer, String> etags = Maps.newTreeMap(); int part; while ((part = algorithm.getNextPart()) <= partCount) { prepareUploadPart(container, key, uploadId, part, payload, algorithm.getNextChunkOffset(), chunkSize, etags); } long remaining = algorithm.getRemaining(); if (remaining > 0) { prepareUploadPart(container, key, uploadId, part, payload, algorithm.getNextChunkOffset(), remaining, etags); } return client.completeMultipartUpload(container, key, uploadId, etags); } catch (RuntimeException ex) { client.abortMultipartUpload(container, key, uploadId); throw ex; } } else { // TODO: find a way to disable multipart. if we pass the original // options, it goes into a stack overflow return client.putObject(container, blobToObject.apply(blob)); } }
From source file:com.google.gdt.eclipse.designer.uibinder.model.widgets.WidgetInfo.java
/** * This method is invoked directly after creation of "this" object. *//* www .j av a 2 s.co m*/ protected void attachAfterConstructor() throws Exception { { Map<String, Object> variables = Maps.newTreeMap(); variables.put("model", this); variables.put("widget", getObject()); String name = "attachAfterConstructorScript"; String script = XmlObjectUtils.getParameter(this, name); Assert.isNotNull2(name, "No {0}", name); getUIObjectUtils().executeScript(script, variables); } }
From source file:com.jivesoftware.sdk.service.instance.action.InstanceUnregisterAction.java
@Nonnull public SortedMap<String, String> toSortedMap() { // Encode the client-secret SortedMap<String, String> sortedMap = Maps.newTreeMap(); sortedMap.put(CLIENT_ID, clientId);//w ww . ja v a 2 s . c o m sortedMap.put(UNINSTALLED, String.valueOf(uninstalled)); sortedMap.put(JIVE_SIGNATURE_URL, jiveSignatureURL); sortedMap.put(JIVE_URL, jiveUrl); sortedMap.put(TENANT_ID, tenantId); sortedMap.put(TIMESTAMP, timestamp); return sortedMap; }
From source file:com.huawei.streaming.cql.semanticanalyzer.CreateDatasourceAnalyzer.java
private TreeMap<String, String> convertSimpleConf(TreeMap<String, String> serdeProperties, String deserClassName) throws SemanticAnalyzerException { String apiOperator = InputOutputOperatorMapping.getAPIOperatorByPlatform(deserClassName); if (apiOperator == null) { return serdeProperties; }/*from w ww . j a va 2 s . c om*/ Map<String, String> configMapping = AnnotationUtils.getConfigMapping(apiOperator); TreeMap<String, String> confs = Maps.newTreeMap(); for (Map.Entry<String, String> et : serdeProperties.entrySet()) { String fullName = et.getKey().toLowerCase(Locale.US); String value = et.getValue(); if (configMapping.containsKey(fullName)) { fullName = configMapping.get(fullName); } confs.put(fullName, value); } return confs; }