List of usage examples for java.util LinkedHashSet LinkedHashSet
public LinkedHashSet()
From source file:edu.uiowa.icts.bluebutton.json.CombinedDemographics.java
private String getCombinedSourceList() { Set<String> set = new LinkedHashSet<String>(); for (Demographics d : this.list) { if (d.getDataSource() != null) { if (set.size() == 0) { set.add(d.getDataSource()); } else if (set.size() == 1 && set.contains("unknown") && !d.getDataSource().equalsIgnoreCase("unknown")) { set = new LinkedHashSet<String>(); set.add(d.getDataSource()); } else if (!d.getDataSource().equalsIgnoreCase("unknown")) { set.add(d.getDataSource()); }//from w w w .java 2 s .com } } if (set.size() > 0) { return StringUtils.join(set.toArray(), ", "); } return null; }
From source file:com.example.config.StartupApplicationListener.java
private Set<Class<?>> sources(ApplicationReadyEvent event) { Method method = ReflectionUtils.findMethod(SpringApplication.class, "getAllSources"); if (method == null) { method = ReflectionUtils.findMethod(SpringApplication.class, "getSources"); }/*from ww w. ja v a 2 s.c o m*/ ReflectionUtils.makeAccessible(method); @SuppressWarnings("unchecked") Set<Object> objects = (Set<Object>) ReflectionUtils.invokeMethod(method, event.getSpringApplication()); Set<Class<?>> result = new LinkedHashSet<>(); for (Object object : objects) { if (object instanceof String) { object = ClassUtils.resolveClassName((String) object, null); } result.add((Class<?>) object); } return result; }
From source file:com.haulmont.cuba.web.gui.components.WebAbstractOptionsBase.java
protected Object getKeyFromValue(Object value) { Object v;/*from w w w . j a v a 2 s. c o m*/ if (isMultiSelect()) { if (value instanceof Collection) { final Set<Object> set = new LinkedHashSet<>(); for (Object o : (Collection) value) { Object t = getKey(o); set.add(t); } v = set; } else { v = getKey(value); } } else { v = getKey(value); } return v; }
From source file:edu.internet2.middleware.psp.spml.config.PsoReferences.java
/** * Gets the reference whose id is the empty value when no references from the context exist. * /*from w w w .j av a2 s . c o m*/ * @return the reference whose id is the empty value when no references from the context exist */ protected List<Reference> getEmptyReferences() { List<Reference> references = new ArrayList<Reference>(); Set<String> targetIds = new LinkedHashSet<String>(); for (PsoReference psoReferenceDefinition : psoReferences) { targetIds.add(psoReferenceDefinition.getToObject().getPsoIdentifier().getTargetId()); } for (String targetId : targetIds) { PSOIdentifier psoID = new PSOIdentifier(); psoID.setTargetID(targetId); psoID.setID(emptyValue); Reference reference = new Reference(); reference.setToPsoID(psoID); reference.setTypeOfReference(name); references.add(reference); } return references; }
From source file:cop.raml.utils.Utils.java
@NotNull public static Set<String> getParams(String uri) { if (StringUtils.isBlank(uri)) return Collections.emptySet(); Set<String> names = new LinkedHashSet<>(); Matcher matcher = URI_PARAM.matcher(uri); while (matcher.find()) names.add(matcher.group(1));//from ww w . j ava 2s . c om return names.isEmpty() ? Collections.emptySet() : names; }
From source file:io.wcm.tooling.netbeans.sightly.completion.classLookup.MemberLookupResolver.java
/** * The actual lookup//w w w. j a v a 2 s . c om * * @return set of all elements which match the lookup */ public Set<MemberLookupResult> performMemberLookup(String variable) { // if there is more than one "." we need to do some magic and resolve the definition fragmented if (variable.contains(".")) { return performNestedLookup(variable); } Set<MemberLookupResult> ret = new LinkedHashSet<>(); // check, if the current variable resolves to a data-sly-use command ParsedStatement statement = getParsedStatement(variable); if (statement == null) { return ret; } if (StringUtils.equals(statement.getCommand(), DataSlyCommands.DATA_SLY_USE.getCommand())) { // this ends the search and we can perform the actual lookup ret.addAll(getResultsForClass(statement.getValue(), variable)); } else { Set<MemberLookupResult> subResults = performMemberLookup( StringUtils.substringBefore(statement.getValue(), ".")); for (MemberLookupResult result : subResults) { if (result.matches(StringUtils.substringAfter(statement.getValue(), "."))) { ret.addAll(getResultsForClass(result.getReturnType(), variable)); } } } return ret; }
From source file:com.sf.springsecurityregistration1.web.controllers.AnnouncementDetailsController.java
/** * Method used to prepare our model and select the view to show / edit * the details of the selected announcement. * * @param announcementId the id of the announcement * @param model the implicit model/*from w ww. j a v a2s .com*/ * @return view name to render (customer/announcement/detail) */ @RequestMapping(value = "/customer/announcement/detail/{announcementId}", method = RequestMethod.GET) public String details(@PathVariable("announcementId") long announcementId, Model model) { Announcements announcement = this.announcementService.findAnnouncement(announcementId); // System.out.println("details " + announcement.getPublicationDate()); Set<Category> headers = new LinkedHashSet<>(); Category currentCategory = new Category(announcement.getHeader()); headers.add(currentCategory); headers.addAll(this.announcementService.findAllCategories()); model.addAttribute("announcements", announcement); model.addAttribute("headers", headers); return "customer/announcement/detail"; }
From source file:edu.vt.middleware.gator.web.support.ParametersEditor.java
/** {@inheritDoc} */ @Override/*from w w w.j a v a 2s .c o m*/ public Object getValue() { final Set<T> copy = new LinkedHashSet<T>(); copy.addAll(paramSet); return copy; }
From source file:it.units.malelab.ege.benchmark.mapper.MappingPropertiesFitness.java
public MappingPropertiesFitness(int genotypeSize, int n, int maxMappingDepth, Random random, List<Problem<String, NumericFitness>> problems, Property... properties) { this.maxMappingDepth = maxMappingDepth; this.problems = new LinkedHashMap<>(); for (Problem<String, NumericFitness> problem : problems) { this.problems.put(problem, new CachedDistance<>(new LeavesEdit<String>())); }/* ww w . j a v a2s . c om*/ this.properties = properties; //build genotypes GeneticOperator<BitsGenotype> mutation = new ProbabilisticMutation(0.01d); BitsGenotypeFactory factory = new BitsGenotypeFactory(genotypeSize); Set<BitsGenotype> set = new LinkedHashSet<>(); for (int i = 0; i < Math.floor(Math.sqrt(n)); i++) { set.addAll( consecutiveMutations(factory.build(random), (int) Math.floor(Math.sqrt(n)), mutation, random)); } while (set.size() < n) { set.add(factory.build(random)); } genotypes = new ArrayList<>(set); //pre compute geno dists Distance<Sequence<Boolean>> genotypeDistance = new Hamming<Boolean>(); genotypeDistances = computeDistances(genotypes, (Distance) genotypeDistance); }
From source file:org.o3project.optsdn.don.NetworkInformation.java
/** * Read defined network information./*from w ww. j ava 2 s . c o m*/ * * @throws Exception File Read Failed */ public void readNetworkInformationFiles() throws Exception { neIdSet = new TreeSet<String>(); portSet = new LinkedHashSet<Port>(); linkMap = new HashMap<String, List<List<Port>>>(); nePtMap = new HashMap<String, String>(); dpidMap = new HashMap<String, Long>(); final String dataDirName = "data"; final String ll1FilePath = dataDirName + File.separator + "ll1.txt"; try { parseBoundaryFile(ll1FilePath); } catch (Exception e) { logger.error("File Read Failed: {}", ll1FilePath); throw e; } final String ll2FilePath = dataDirName + File.separator + "ll2.txt"; try { parseBoundaryFile(ll2FilePath); } catch (Exception e) { logger.error("File Read Failed: {}", ll2FilePath); throw e; } final String ochLinkFilePath = dataDirName + File.separator + "och_link.txt"; try { parseOchLinkFile(ochLinkFilePath); } catch (Exception e) { logger.error("File Read Failed: {}", ochLinkFilePath); throw e; } final String idExFilePath = dataDirName + File.separator + "idex.txt"; try { parseIdExFile(idExFilePath); } catch (Exception e) { logger.error("File Read Failed: {}", idExFilePath); throw e; } logNetworkInformations(); }