List of usage examples for com.google.common.collect Maps newLinkedHashMap
public static <K, V> LinkedHashMap<K, V> newLinkedHashMap()
From source file:org.eclipse.buildship.ui.view.execution.ExecutionProgressListener.java
public ExecutionProgressListener(Page executionPage, OperationItem root) { this.executionPage = Preconditions.checkNotNull(executionPage); this.executionItemMap = Maps.newLinkedHashMap(); this.executionItemMap.put(null, Preconditions.checkNotNull(root)); this.operationItemRenderer = new OperationItemRenderer(); }
From source file:com.google.caliper.runner.JarFinder.java
@VisibleForTesting static ImmutableMap<URI, ClassLoader> getClassPathEntries(ClassLoader classloader) { Map<URI, ClassLoader> entries = Maps.newLinkedHashMap(); // Search parent first, since it's the order ClassLoader#loadClass() uses. ClassLoader parent = classloader.getParent(); if (parent != null) { entries.putAll(getClassPathEntries(parent)); }//from w w w .j a va 2s . c om if (classloader instanceof URLClassLoader) { URLClassLoader urlClassLoader = (URLClassLoader) classloader; for (URL entry : urlClassLoader.getURLs()) { URI uri; try { uri = entry.toURI(); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } if (!entries.containsKey(uri)) { entries.put(uri, classloader); } } } return ImmutableMap.copyOf(entries); }
From source file:org.ldp4j.application.sdk.QueryBuilder.java
public Query build() { final Map<String, ImmutableQueryParameter> parameterMap = Maps.newLinkedHashMap(); for (Entry<String, Collection<Object>> entry : this.parameters.asMap().entrySet()) { String name = entry.getKey(); Collection<Object> rawValues = entry.getValue(); parameterMap.put(name, ImmutableQueryParameter.create(name, rawValues)); }//from ww w . j a v a 2s . c om return ImmutableQuery.create(parameterMap); }
From source file:de.fhg.iais.cortex.search.types.GenericSearchResult.java
public GenericSearchResult(String id) { this.id = id; this.fields = Maps.newLinkedHashMap(); this.match = Lists.newArrayList(); }
From source file:com.android.build.gradle.integration.common.utils.ZipHelper.java
/** * Checks that a zip file contains all files in the list. *//*from w w w.jav a 2 s. c om*/ public static void checkFileExists(@NonNull File archive, @NonNull Set<String> paths) throws IOException { Map<String, byte[]> pathToContent = Maps.newLinkedHashMap(); for (String path : paths) { pathToContent.put(path, null); } checkArchive(archive, pathToContent, ImmutableSet.<String>of()); }
From source file:util.mybatis.comment.ClassCommentPlugin.java
/** * ?.//from w w w . j a va 2 s . c o m * * @param introspectedTable the introspected table * @param interfaze the interfaze */ public void classGenerated(IntrospectedTable introspectedTable, Interface interfaze) { Map<String, Object> local = Maps.newLinkedHashMap(); local.put("todo", new ClassWrapper(introspectedTable)); local.put("tags", ""); String classComment = CodetemplatesLoader.getInstance().get("typecomment_context"); classComment = VelocityUtils.evaluate(classComment, local); try { List<String> lines = CharStreams.readLines(CharStreams.newReaderSupplier(classComment)); if (lines == null) { return; } boolean isfirst = true; for (String line : lines) { line = line.trim(); if (Strings.isNullOrEmpty(line)) { continue; } if (!isfirst) { line = " " + line; } interfaze.addJavaDocLine(line); isfirst = false; } } catch (IOException e) { throw new RuntimeException(e); } }
From source file:org.apache.brooklyn.core.mgmt.persist.PropertiesConfigLoader.java
@Override public Map<String, String> load() { try {//from w ww.j a v a 2s . c o m InputStream resource = new ResourceUtils(PropertiesConfigLoader.class) .getResourceFromUrl(propertiesPath); try { Properties props = new Properties(); props.load(resource); Map<String, String> result = Maps.newLinkedHashMap(); for (Enumeration<?> iter = props.propertyNames(); iter.hasMoreElements();) { String key = (String) iter.nextElement(); String value = props.getProperty(key); result.put(key, value); } return result; } catch (IOException e) { throw Exceptions.propagate(e); } finally { Streams.closeQuietly(resource); } } catch (Exception e) { LOG.warn("Failed to load properties file from " + propertiesPath + " (continuing)", e); return ImmutableMap.<String, String>of(); } }
From source file:com.github.djabry.platform.service.security.DefaultPermissionMapper.java
@PostConstruct public void setupMap() { m = Maps.newLinkedHashMap(); Set<Permission> appPermissions = Sets.newLinkedHashSet(); appPermissions.add(Permission.AUTHENTICATE); m.put(Role.APPLICATION, appPermissions); Set<Permission> userPermissions = Sets.newLinkedHashSet(appPermissions); userPermissions.add(Permission.READ_OWN); userPermissions.add(Permission.CREATE_OWN); userPermissions.add(Permission.UPDATE_OWN); userPermissions.add(Permission.DELETE_OWN); m.put(Role.USER, userPermissions); m.put(Role.APPLICATION, appPermissions); Set<Permission> adminPermissions = Sets.newLinkedHashSet(userPermissions); adminPermissions.add(Permission.READ_ANY); adminPermissions.add(Permission.CREATE_ANY); adminPermissions.add(Permission.DELETE_ANY); adminPermissions.add(Permission.UPDATE_ANY); m.put(Role.ADMINISTRATOR, adminPermissions); }
From source file:org.apache.mahout.utils.vectors.lucene.CachedTermInfo.java
public CachedTermInfo(IndexReader reader, String field, int minDf, int maxDfPercent) throws IOException { this.field = field; Terms t = MultiFields.getTerms(reader, field); TermsEnum te = t.iterator(null);/* www.j av a2s . c o m*/ int numDocs = reader.numDocs(); double percent = numDocs * maxDfPercent / 100.0; //Should we use a linked hash map so that we know terms are in order? termEntries = Maps.newLinkedHashMap(); int count = 0; BytesRef text; while ((text = te.next()) != null) { int df = te.docFreq(); if (df >= minDf && df <= percent) { TermEntry entry = new TermEntry(text.utf8ToString(), count++, df); termEntries.put(entry.getTerm(), entry); } } }
From source file:edu.cmu.lti.oaqa.ecd.config.StagedConfigurationImpl.java
Iterator<Stage> buildStagedConfigs(Iterable<AnyObject> stages) { List<Stage> confs = Lists.newArrayList(); List<Object> pipeline = Lists.newArrayList(); int count = 1; for (AnyObject stage : stages) { Map<String, Object> conf = Maps.newLinkedHashMap(); for (AnyTuple tuple : original.getTuples()) { if (!tuple.getKey().equals(STAGES_NODE_NAME)) { conf.put(tuple.getKey(), tuple.getObject()); }//from ww w . j av a 2s . com } List<Object> inner = Lists.newArrayList(pipeline); for (Object o : stage.getIterable("pipeline")) { inner.add(o); AnyObject component = (AnyObject) o; String scope = component.getString(SCOPE_NODE_NAME); addComponentIfInGlobalScope(o, pipeline, scope); } conf.put("pipeline", inner); conf.put("post-process", stage.getIterable("post-process")); confs.add(new Stage(count, new MapBasedAnyObject(conf))); count++; } return confs.iterator(); }