List of usage examples for com.google.common.collect Sets newTreeSet
public static <E extends Comparable> TreeSet<E> newTreeSet()
From source file:co.cask.cdap.gateway.handlers.ApplicationTemplateHandler.java
/** * Gets details about the given template. * Response is a {@link ApplicationTemplateDetail} object. * * @param templateId the template id to query for *//*from www . java 2 s .c om*/ @Path("/{template-id}") @GET public void getTemplate(HttpRequest request, HttpResponder responder, @PathParam("template-id") String templateId) throws NotFoundException { ApplicationTemplateInfo templateInfo = adapterService.getApplicationTemplateInfo(templateId); if (templateInfo == null) { throw new NotFoundException(Id.ApplicationTemplate.from(templateId)); } Map<PluginInfo, Collection<PluginClass>> plugins = pluginRepository.getPlugins(templateInfo.getName()); Set<String> extensions = Sets.newTreeSet(); for (Map.Entry<PluginInfo, Collection<PluginClass>> entry : plugins.entrySet()) { for (PluginClass pluginClass : entry.getValue()) { extensions.add(pluginClass.getType()); } } ApplicationTemplateDetail templateDetail = new ApplicationTemplateDetail(templateInfo.getName(), templateInfo.getDescription(), templateInfo.getProgramType(), extensions); responder.sendJson(HttpResponseStatus.OK, templateDetail); }
From source file:org.sonar.server.issue.ws.TagsAction.java
private List<String> listTags(OrganizationDto organization, @Nullable String textQuery, int pageSize) { Collection<String> issueTags = issueIndex.listTags(organization, textQuery, pageSize); Collection<String> ruleTags = ruleIndex.listTags(organization, textQuery, pageSize); SortedSet<String> result = Sets.newTreeSet(); result.addAll(issueTags);//from w w w . j a v a 2 s .c o m result.addAll(ruleTags); List<String> resultAsList = Lists.newArrayList(result); return resultAsList.size() > pageSize && pageSize > 0 ? resultAsList.subList(0, pageSize) : resultAsList; }
From source file:org.eclipse.wb.internal.swing.model.property.editor.color.AwtColors.java
/** * @return {@link ColorInfo}'s for colors from {@link UIManager}. *//* ww w . ja v a 2s .c o m*/ public static ColorInfo[] getColors_Swing() { String lafClassName = UIManager.getLookAndFeel().getClass().getName(); ColorInfo[] colors = m_LAFColors.get(lafClassName); if (colors == null) { List<ColorInfo> colorList = Lists.newArrayList(); { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); // prepare set of all String keys in UIManager Set<String> allKeys = Sets.newTreeSet(); for (Iterator<?> I = defaults.keySet().iterator(); I.hasNext();) { Object key = I.next(); if (key instanceof String) { allKeys.add((String) key); } } // add ColorInfo for each Color key for (String key : allKeys) { Color color = defaults.getColor(key); if (color != null) { ColorInfo colorInfo = new ColorInfo(key, color.getRed(), color.getGreen(), color.getBlue()); colorInfo.setData("javax.swing.UIManager.getColor(\"" + key + "\")"); colorInfo.setToolkitColor(color); colorList.add(colorInfo); } } } // convert into array colors = colorList.toArray(new ColorInfo[colorList.size()]); m_LAFColors.put(lafClassName, colors); } return colors; }
From source file:org.obiba.opal.core.service.security.DefaultSubjectAclService.java
@Override public void deleteNodeHierarchyPermissions(String domain, String node) { deleteNodePermissions(domain, node); Set<Subject> subjects = Sets.newTreeSet(); for (SubjectAcl acl : Iterables.concat(find(domain, node), findLike(domain, node + "/"))) { subjects.add(acl.getSubject());//from w ww . j a va2 s. c om delete(acl); } notifyListeners(subjects); }
From source file:com.mingo.query.Query.java
/** * Add query case.//from w w w . java 2s.com * * @param queryCase query case */ public void addQueryCase(QueryCase queryCase) { Validate.notNull(queryCase, "query case cannot be null"); if (CollectionUtils.isEmpty(cases)) { cases = Sets.newTreeSet(); } cases.add(queryCase); }
From source file:org.apache.lens.cube.metadata.timeline.PartitionTimeline.java
/** * Add partition to local memory to be sent for batch addition. * * @see #commitBatchAdditions()/* w w w .j av a 2s. c o m*/ */ public void addForBatchAddition(TimePartition partition) { if (all == null) { all = Sets.newTreeSet(); } all.add(partition); }
From source file:uk.ac.ebi.spot.rdf.model.baseline.ExperimentalFactors.java
public SortedSet<Factor> getFilteredFactors(final Set<Factor> filterFactors) { if (CollectionUtils.isEmpty(filterFactors)) { return getAllFactors(); }/*from w w w. jav a 2 s . co m*/ TreeSet<Factor> filteredFactors = Sets.newTreeSet(); for (FactorGroup factorGroup : orderedFactorGroups) { List<Factor> remainingFactors = factorGroup.remove(filterFactors); if (remainingFactors.size() == 1) { filteredFactors.add(remainingFactors.get(0)); } } return filteredFactors; }
From source file:uk.ac.ebi.atlas.search.baseline.BaselineExperimentAssayGroupSearchService.java
public static SortedSet<BaselineExperimentAssayGroup> emptySortedSet() { return Sets.newTreeSet(); }
From source file:blackboard.plugin.hayabusa.provider.CourseProvider.java
private Iterable<Command> getMyCourses(User user) { try {/* w w w. jav a 2 s . c om*/ List<Course> courses = CourseDbLoader.Default.getInstance().loadByUserId(user.getId()); Set<Command> commands = Sets.newTreeSet(); for (Course course : courses) { String url = String.format(My_COURSE_URL_TEMPLATE, course.getId().toExternalString()); url = FramesetUtil.getTabGroupUrl(blackboard.data.navigation.Tab.TabType.courses, url); SimpleCommand command = new SimpleCommand(course.getTitle(), url, Category.COURSE); commands.add(command); } return commands; } catch (PersistenceException e) { throw new PersistenceRuntimeException(e); } }
From source file:org.terasology.ligthandshadow.componentsystem.controllers.EnemySystem.java
private void addDistance(EntityRef one, EntityRef two, float dist) { Set<Distance> map = distances.get(one); if (map == null) { map = Sets.newTreeSet(); distances.put(one, map);/* w ww . ja v a 2 s . c om*/ } map.add(new Distance(two, dist)); }