List of usage examples for java.util TreeSet TreeSet
public TreeSet()
From source file:com.cloudbees.demo.beesshop.product.ProductRepository.java
/** * @param name/*from w w w .jav a2 s .c o m*/ * @return */ public Collection<Product> find(@Nullable String name) { SortedSet<Product> result = new TreeSet<Product>(); for (Product product : products.values()) { if (name == null && name == null) { result.add(product); } if (StringUtils.hasLength(name)) { if (product.getName().toLowerCase().contains(name.toLowerCase())) { result.add(product); break; } } } return result; }
From source file:com.liteoc.bean.extract.odm.OdmXmlReportBean.java
/** * In this constructor, xmlHeading = "<?xml version=\"1.0\" * encoding=\"UTF-8\"?>";/*from w w w .j a va 2s. c om*/ */ public OdmXmlReportBean() { xmlOutput = new StringBuffer(); xmlHeading = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; indent = " "; // locale_df_string = // ResourceBundleProvider.getFormatBundle().getString("date_format_string"); uniqueNameTable = new TreeSet<String>(); sasNameValidator = new SasNameValidator(); sasNameValidator.setUniqueNameTable(this.uniqueNameTable); sasFormatValidator = new ODMSASFormatNameValidator(); sasFormatValidator.setUniqueNameTable(this.uniqueNameTable); }
From source file:de.tudarmstadt.ukp.experiments.argumentation.convincingness.features.SpellCheckingFeature.java
@Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); try {//from w ww.j a v a2s. co m vocabulary = new TreeSet<String>(); File wordFile = new File("/usr/share/dict/words"); if (!wordFile.exists()) { throw new IOException("File not found " + wordFile); } // load vocabulary vocabulary.addAll(FileUtils.readLines(wordFile, "utf-8")); getLogger().info("Loaded " + vocabulary.size() + " words"); } catch (IOException e) { throw new ResourceInitializationException(e); } }
From source file:at.porscheinformatik.sonarqube.licensecheck.ValidateLicenses.java
public Set<License> getUsedLicenses(Set<Dependency> dependencies, Project module) { Set<License> usedLicenseList = new TreeSet<>(); List<License> licenses = licenseService.getLicenses(module.getRoot()); for (Dependency dependency : dependencies) { for (License license : licenses) { if (license.getIdentifier().equals(dependency.getLicense())) { usedLicenseList.add(license); }/*w w w. j a va 2 s. co m*/ } } return usedLicenseList; }
From source file:org.codeqinvest.sonar.ProjectsCollectorService.java
/** * Collects all Java projects of the specified Sonar server. *//*from w w w. j a v a 2 s. c o m*/ public Set<ProjectInformation> collectAllProjects(SonarConnectionSettings connectionSettings) { Sonar sonar = new Sonar(new HttpClient4Connector(connectionSettings.asHostObject())); List<Resource> projectResources = sonar.findAll(new ResourceQuery()); Set<ProjectInformation> projects = new TreeSet<ProjectInformation>(); for (Resource resource : projectResources) { projects.add(new ProjectInformation(resource.getName(), resource.getKey())); } return projects; }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.PeriodXmlSerializerTest.java
protected void setUp() throws Exception { super.setUp(); element = registerMockFor(Element.class); plannedActivitySerializer = registerMockFor(PlannedActivityXmlSerializer.class); serializer = new PeriodXmlSerializer(); serializer.setChildXmlSerializer(plannedActivitySerializer); period = setGridId("grid0", Fixtures.createPeriod("Period A", 1, 7, 3)); periods = new TreeSet<Period>(); }
From source file:ca.travelagency.components.fields.TravelDocumentField.java
@Override protected Iterator<String> getChoices(String input) { if (StringUtils.isEmpty(input)) { return Collections.<String>emptyList().iterator(); }/*w ww. j a v a 2 s .co m*/ SortedSet<String> choices = new TreeSet<String>(); Locale[] locales = Locale.getAvailableLocales(); for (Locale locale : locales) { String country = locale.getDisplayCountry().toUpperCase(); if (country.startsWith(input.toUpperCase())) { String value = getLocalizer().getString(country, this, country); if (StringUtils.isBlank(value)) { value = country; } choices.add(WordUtils.capitalize(StringUtils.lowerCase(value + " " + suffix))); if (choices.size() == DISPLAY_MAX_SIZE) { break; } } } return choices.iterator(); }
From source file:com.googlecode.android_scripting.jsonrpc.JsonResultBuildersTest.java
public void testBuildJsonSet() throws JSONException { Set<String> objects = new TreeSet<String>(); objects.add("foo"); objects.add("bar"); objects.add("baz"); JSONArray result = (JSONArray) JsonBuilder.build(objects); assertEquals(result.get(0), "bar"); assertEquals(result.get(1), "baz"); assertEquals(result.get(2), "foo"); }
From source file:org.jasig.portlet.contacts.adapters.impl.xml.XMLContactAdapter.java
@Override public Set<ContactSet> getContacts() { Set<ContactSet> contacts = new TreeSet<ContactSet>(); InputStream is = null;//from w ww . jav a2 s . co m for (String dataURI : dataURIs) { ContactSet contactSet; try { is = getClass().getClassLoader().getResourceAsStream(dataURI); contactSet = (ContactSet) unmarshaller.unmarshal(new StreamSource(is)); contacts.add(contactSet); } catch (Exception ex) { Logger.getLogger(XMLContactAdapter.class.getName()).log(Level.SEVERE, null, ex); } finally { if (is != null) { try { is.close(); } catch (IOException ex) { Logger.getLogger(XMLContactAdapter.class.getName()).log(Level.SEVERE, null, ex); } } } } return contacts; }
From source file:com.alibaba.jstorm.task.backpressure.SourceBackpressureInfo.java
public SourceBackpressureInfo() { this.tasks = new TreeSet<Integer>(); this.targetTasks = new HashMap<String, TargetBackpressureInfo>(); }