List of usage examples for java.util TreeSet add
public boolean add(E e)
From source file:SaveImage.java
public String[] getFormats() { String[] formats = ImageIO.getWriterFormatNames(); TreeSet<String> formatSet = new TreeSet<String>(); for (String s : formats) { formatSet.add(s.toLowerCase()); }// ww w. ja va2 s. c o m return formatSet.toArray(new String[0]); }
From source file:edu.uiowa.icts.bluebutton.json.view.EncountersMetaFinder.java
public String getOrganizations() { TreeSet<String> orgSet = new TreeSet<String>(); for (Encounter e : this.list) { if (e.getLocation() != null && e.getLocation().getOrganization() != null) { orgSet.add(e.getLocation().getOrganization()); }/*from w w w . j av a 2 s .co m*/ } if (orgSet.size() > 0) { return StringUtils.join(orgSet, ", "); } return null; }
From source file:jenkins.scm.impl.subversion.SubversionSCMSource.java
/** * Split a comma separated set of includes/excludes into a set of strings. * * @param cludes a comma separated set of includes/excludes. * @return a set of strings.//from w w w. j av a 2 s . co m */ @NonNull static SortedSet<String> splitCludes(@CheckForNull String cludes) { TreeSet<String> result = new TreeSet<String>(); StringTokenizer tokenizer = new StringTokenizer(StringUtils.defaultString(cludes), ","); while (tokenizer.hasMoreTokens()) { String clude = tokenizer.nextToken().trim(); if (StringUtils.isNotEmpty(clude)) { result.add(clude.trim()); } } return result; }
From source file:net.spfbl.core.Client.java
public static HashMap<Object, TreeSet<Client>> getAdministratorMap() { HashMap<Object, TreeSet<Client>> clientMap = new HashMap<Object, TreeSet<Client>>(); for (Client client : getSet()) { if (client.isAdministrator()) { User user = client.getUser(); Object key = user == null ? client.getDomain() : user; TreeSet<Client> clientSet = clientMap.get(key); if (clientSet == null) { clientSet = new TreeSet<Client>(); clientMap.put(key, clientSet); }/*from ww w. ja v a 2s . com*/ clientSet.add(client); } } return clientMap; }
From source file:com.rapidminer.operator.preprocessing.discretization.UserBasedDiscretization.java
@Override protected Collection<AttributeMetaData> modifyAttributeMetaData(ExampleSetMetaData emd, AttributeMetaData amd) throws UndefinedParameterError { AttributeMetaData newAMD = new AttributeMetaData(amd.getName(), Ontology.NOMINAL, amd.getRole()); List<String[]> rangeList = getParameterList(PARAMETER_RANGE_NAMES); TreeSet<String> values = new TreeSet<String>(); for (String[] pair : rangeList) { values.add(pair[0]); }//w w w . jav a 2s. com newAMD.setValueSet(values, SetRelation.SUBSET); return Collections.singletonList(newAMD); }
From source file:com.btmura.android.reddit.content.RelatedSubredditLoader.java
private TreeSet<String> findSubreddits(CharSequence description) { TreeSet<String> subreddits = new TreeSet<String>(Collator.getInstance()); Matcher matcher = SUBREDDIT_PATTERN.matcher(description); while (matcher.find()) { subreddits.add(matcher.group(1)); }/*from w w w . j ava 2s .c o m*/ return subreddits; }
From source file:org.bedework.eventreg.web.OutputCSVController.java
@Override public ModelAndView doRequest() throws Throwable { if (sessMan.getCurrentCalsuite() == null) { return errorReturn("No calsuite"); }//ww w . ja v a 2s. c o m final String formName = sessMan.getCurrentFormName(); final FormDef form = sessMan.getFormDef(formName); final TreeSet<Registration> regs = new TreeSet<>(); for (final Registration reg : sessMan.getRegistrationsByHref(req.getHref())) { reg.setEvent(sessMan.retrieveEvent(reg)); regs.add(reg); } final CSVOutputter csv = new CSVOutputter(sessMan.getCurrEvent(), form, regs); req.getResponse().setHeader("Content-Disposition", "Attachment; Filename=\"" + req.getFilename("eventreg.csv") + "\""); //response.setContentType("application/vnd.ms-excel; charset=UTF-8"); return objModel(getForwardSuccess(), "csv", csv); }
From source file:de.uzk.hki.da.cb.ScanAction.java
protected TreeSet<String> neverConverted() { TreeSet<String> ret = new TreeSet<String>(); ret.add(C.PREMIS_XML); ret.add(C.PUBLIC_METS);//from w w w.java 2s .c om if (o.getMetadata_file() != null) { ret.add(o.getMetadata_file()); String packageType = o.getPackage_type(); if ("EAD".equals(packageType)) { String mfPathSrc = o.getLatest(o.getMetadata_file()).getPath().toString(); EadMetsMetadataStructure emms = null; try { emms = new EadMetsMetadataStructure(wa.dataPath(), new File(mfPathSrc), o.getDocuments()); } catch (Exception e) { e.printStackTrace(); } if (emms != null) { List<String> metse = emms.getMetsRefsInEad(); for (int mmm = 0; mmm < metse.size(); mmm++) { String mets = metse.get(mmm); String normMets = FilenameUtils.normalize(mets); if (normMets != null) { mets = normMets; } ret.add(mets); } } } } return ret; }
From source file:net.spfbl.core.Client.java
public synchronized static TreeSet<Client> getSetByCIDR(String cidr, String permission) { if ((cidr = Subnet.normalizeCIDR(cidr)) == null) { return null; } else {//from w w w . j a v a2 s . c o m String first = Subnet.getFirstIP(cidr); String last = Subnet.getLastIP(cidr); String keyFirst = Subnet.expandIP(first); String keyLast = Subnet.expandIP(last); SortedMap<String, Client> subMap = MAP.subMap(keyFirst, true, keyLast, true); TreeSet<Client> clientSet = new TreeSet<Client>(); for (Client client : subMap.values()) { if (client.isPermission(permission)) { if (client.contains(first)) { clientSet.add(client); } else if (client.contains(last)) { clientSet.add(client); } else { String cidrClient = client.getCIDR(); String firstClient = Subnet.getFirstIP(cidrClient); String lastClient = Subnet.getLastIP(cidrClient); if (Subnet.containsIP(cidr, firstClient)) { clientSet.add(client); } else if (Subnet.containsIP(cidr, lastClient)) { clientSet.add(client); } } } } return clientSet; } }
From source file:net.spfbl.core.Client.java
public static HashMap<Object, TreeSet<Client>> getMap(Permission permission) { if (permission == null) { return null; } else {//w w w . j a va 2 s . c o m HashMap<Object, TreeSet<Client>> clientMap = new HashMap<Object, TreeSet<Client>>(); for (Client client : getSet()) { if (client.hasPermission(permission)) { User user = client.getUser(); Object key = user == null ? client.getDomain() : user; TreeSet<Client> clientSet = clientMap.get(key); if (clientSet == null) { clientSet = new TreeSet<Client>(); clientMap.put(key, clientSet); } clientSet.add(client); } } return clientMap; } }