List of usage examples for com.google.common.collect Maps newLinkedHashMap
public static <K, V> LinkedHashMap<K, V> newLinkedHashMap()
From source file:cc.recommenders.evaluation.evaluators.NMF1Evaluator.java
@Override public void reinit() { results = Maps.newLinkedHashMap(); }
From source file:com.google.caliper.runner.JarFinder.java
/** * Returns a list of jar files reachable from the given class loaders. * * <p>Currently only {@link URLClassLoader} and only {@code file://} urls are supported. * * @throws IOException if the attempt to read class path resources (jar files or directories) * failed.// ww w. ja v a 2 s. c o m */ public static ImmutableSet<File> findJarFiles(ClassLoader first, ClassLoader... rest) throws IOException { Scanner scanner = new Scanner(); Map<URI, ClassLoader> map = Maps.newLinkedHashMap(); for (ClassLoader classLoader : Lists.asList(first, rest)) { map.putAll(getClassPathEntries(classLoader)); } for (Map.Entry<URI, ClassLoader> entry : map.entrySet()) { scanner.scan(entry.getKey(), entry.getValue()); } return scanner.jarFiles(); }
From source file:io.smartspaces.master.ui.internal.web.WebSupport.java
/** * Get a selection list of activities.// w w w .jav a 2 s . co m * * @param activities * The activities. * * @return an ordered list of activities */ public static Map<String, String> getActivitySelections(List<Activity> activities) { List<Activity> toBeSorted = Lists.newArrayList(activities); Collections.sort(toBeSorted, MasterApiUtilities.ACTIVITY_BY_NAME_AND_VERSION_COMPARATOR); Map<String, String> items = Maps.newLinkedHashMap(); for (Activity activity : toBeSorted) { items.put(activity.getId(), String.format("%s - %s", activity.getName(), activity.getVersion())); } return items; }
From source file:gobblin.metrics.Tagged.java
public Tagged(Collection<Tag<?>> tags) { this.tags = Maps.newLinkedHashMap(); addTags(tags); }
From source file:com.enonic.cms.business.core.content.mail.AbstractAssignmentMailTemplate.java
protected String createAssignmentMailInfoElement() { String contentPath = content.getPathAsString(); StringBuffer body = new StringBuffer(); Map<String, String> keyValues = Maps.newLinkedHashMap(); if (StringUtils.isNotBlank(contentPath)) { addKeyValue(keyValues, "%fldStatus%", getTranslatedStatus(contentVersion.getStatus())); if (assignmentDueDate != null) { addKeyValue(keyValues, "%contentAssignmentDuedate%", dateFormat.format(assignmentDueDate)); }// w w w . j av a2 s .c om addKeyValue(keyValues, "%fldDisplayName%", contentVersion.getTitle()); addKeyValue(keyValues, "%fldContentType%", content.getContentType().getName()); addKeyValue(keyValues, "%contentAssignedBy%", createUserName(assigner)); addKeyValue(keyValues, "%contentAssignmentPath%", contentPath); } String adminUrl = getAdminUrl(content.getKey()); if (StringUtils.isNotBlank(adminUrl)) { addKeyValue(keyValues, "%blockURL%", adminUrl); } appendKeyValuesWithPadding(body, keyValues); return body.toString(); }
From source file:org.terasology.persistence.typeHandling.coreTypes.StringMapTypeHandler.java
@Override public PersistedData serialize(Map<String, T> value, SerializationContext context) { Map<String, PersistedData> map = Maps.newLinkedHashMap(); for (Map.Entry<String, T> entry : value.entrySet()) { PersistedData item = contentsHandler.serialize(entry.getValue(), context); if (!item.isNull()) { map.put(entry.getKey(), item); }/*from w ww.j ava2 s . c o m*/ } return context.create(map); }
From source file:org.apache.brooklyn.location.jclouds.templates.customize.UserMetadataMapOption.java
private Map<String, String> toMapStringString(Object v) { if (v instanceof Map<?, ?>) { Map<String, String> result = Maps.newLinkedHashMap(); for (Map.Entry<?, ?> entry : ((Map<?, ?>) v).entrySet()) { String key = entry.getKey().toString(); String value = entry.getValue().toString(); result.put(key, value);//from w ww.j a va 2s . co m } return result; } else if (v instanceof CharSequence) { return KeyValueParser.parseMap(v.toString()); } else { throw new IllegalArgumentException( "Invalid type for Map<String,String>: " + v + (v != null ? " of type " + v.getClass() : "")); } }
From source file:de.cosmocode.palava.ipc.execvm.ExecutingFilterChain.java
@Override public Map<String, Object> filter(IpcCall call, IpcCommand command) throws IpcCommandExecutionException { final Map<String, Object> result = Maps.newLinkedHashMap(); LOG.debug("Executing {}", command); try {/*w ww . j a va 2s. co m*/ command.execute(call, result); } catch (IpcCommandExecutionException e) { if (e.getCause() == null || IpcCommands.mayThrow(command.getClass(), e.getCause())) { LOG.debug("An expected exception was thrown while executing " + command, e); } else { LOG.error("An undeclared exception was thrown while executing " + command + " with arguments: " + call.getArguments(), e); } throw e; /* CHECKSTYLE:OFF */ } catch (RuntimeException e) { /* CHECKSTYLE:ON */ if (IpcCommands.mayThrow(command.getClass(), e)) { LOG.debug("An expected exception was thrown while executing " + command, e); } else { LOG.error("An unexpected exception was thrown while executing " + command + " with arguments: " + call.getArguments(), e); } throw e; } return result; }
From source file:no.ssb.vtl.script.VTLScriptContext.java
@SuppressWarnings("WeakerAccess") public VTLScriptContext() { super();/*from w ww .ja v a 2s. c o m*/ engineScope = new SimpleBindings(Maps.newLinkedHashMap()); scopes = new HashMap<>(2); scopes.put(ENGINE_SCOPE, engineScope); scopes.put(GLOBAL_SCOPE, new SimpleBindings(Maps.newLinkedHashMap())); }
From source file:exec.csharp.evaluation.impl.F1Details.java
@Override public void run() { res = Maps.newLinkedHashMap(); counts = Maps.newLinkedHashMap(); eval.run(this); }