List of usage examples for java.util LinkedHashSet LinkedHashSet
public LinkedHashSet()
From source file:org.eclipse.virgo.ide.facet.core.BundleFacetUninstallDelegate.java
protected void removeFromClasspath(IJavaProject javaProject, IClasspathEntry entry, IProgressMonitor monitor) throws CoreException { Set<IClasspathEntry> entries = new LinkedHashSet<IClasspathEntry>(); for (IClasspathEntry existingEntry : javaProject.getRawClasspath()) { if (!existingEntry.equals(entry)) { entries.add(existingEntry);/*from w w w .j av a 2 s . com*/ } } javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), monitor); }
From source file:edu.uci.ics.jung.graph.DirectedOrderedSparseMultigraph.java
@Override public boolean addVertex(V vertex) { if (vertex == null) { throw new IllegalArgumentException("vertex may not be null"); }// www. j a va 2 s . c o m if (!containsVertex(vertex)) { vertices.put(vertex, new Pair<Set<E>>(new LinkedHashSet<E>(), new LinkedHashSet<E>())); return true; } else { return false; } }
From source file:com.bradmcevoy.http.webdav.DefaultPropFindRequestFieldParser.java
@Override public PropertiesRequest getRequestedFields(InputStream in) { try {//from w w w.java 2 s . c o m final Set<QName> set = new LinkedHashSet<QName>(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); StreamUtils.readTo(in, bout, false, true); byte[] arr = bout.toByteArray(); if (arr.length > 1) { ByteArrayInputStream bin = new ByteArrayInputStream(arr); XMLReader reader = XMLReaderFactory.createXMLReader(); PropFindSaxHandler handler = new PropFindSaxHandler(); reader.setContentHandler(handler); try { reader.parse(new InputSource(bin)); if (handler.isAllProp()) { return new PropertiesRequest(); } else { set.addAll(handler.getAttributes().keySet()); } } catch (IOException e) { log.warn("exception parsing request body", e); // ignore } catch (SAXException e) { log.warn("exception parsing request body", e); // ignore } } return PropertiesRequest.toProperties(set); } catch (Exception ex) { throw new RuntimeException(ex); } }
From source file:com.bstek.dorado.core.SpringApplicationContext.java
private Resource[] getConfigLocations(String configLocation) throws IOException { Set<Resource> resourceSet = new LinkedHashSet<Resource>(); String[] configLocations = StringUtils.split(configLocation, LOCATION_SEPARATOR); for (String location : configLocations) { if (StringUtils.isNotBlank(location)) { CollectionUtils.addAll(resourceSet, getResources(location)); }//from ww w . j a v a 2 s .c om } for (Iterator<Resource> it = resourceSet.iterator(); it.hasNext();) { Resource resource = it.next(); if (!resource.exists()) { logger.warn("Resource [" + resource + "] does not exist."); it.remove(); } } Resource[] resources = new Resource[resourceSet.size()]; resourceSet.toArray(resources); return resources; }
From source file:com.shenit.commons.utils.CollectionUtils.java
/** * ?/*from ww w .j a v a 2s. c o m*/ * @param vals * @return */ public static <T> Set<T> loadSortedSet(T[] vals) { LinkedHashSet<T> set = new LinkedHashSet<>(); for (T v : vals) if (v != null) set.add(v); return set; }
From source file:com.hurence.logisland.plugin.PluginManager.java
private static Set<ArtifactDownloadReport> downloadArtifacts(Ivy ivy, ModuleRevisionId moduleRevisionId, String[] confs) throws Exception { ResolveOptions resolveOptions = new ResolveOptions(); resolveOptions.setDownload(true);/*from w w w . ja va 2 s. c o m*/ resolveOptions.setTransitive(true); resolveOptions.setOutputReport(false); resolveOptions.setConfs(confs); resolveOptions.setLog(null); resolveOptions.setValidate(false); resolveOptions.setCheckIfChanged(true); ResolveReport report = (ivy.resolve(moduleRevisionId, resolveOptions, true)); Set<ArtifactDownloadReport> reports = new LinkedHashSet<>(); reports.addAll(Arrays.asList(report.getAllArtifactsReports())); resolveOptions.setTransitive(false); for (ArtifactDownloadReport artifactDownloadReport : report.getFailedArtifactsReports()) { reports.add( ivy.getResolveEngine().download( new DefaultArtifact(artifactDownloadReport.getArtifact().getModuleRevisionId(), artifactDownloadReport.getArtifact().getPublicationDate(), artifactDownloadReport.getArtifact().getName(), "jar", "jar"), new DownloadOptions())); } return reports; }
From source file:com.haulmont.cuba.web.gui.components.WebAbstractOptionsBase.java
protected <V> V getValueFromKey(Object key) { if (key instanceof Collection) { final Set<Object> set = new LinkedHashSet<>(); for (Object o : (Collection) key) { Object t = getValue(o); set.add(t);/*from w ww . j a va 2 s.c o m*/ } return (V) set; } else { final Object o = getValue(key); return wrapAsCollection(o); } }
From source file:de.vandermeer.skb.interfaces.messagesets.IsInfoSet.java
/** * Creates a new info set.// w w w . j av a 2 s . c o m * @param <M> type of the messages in the set * @return new info set */ static <M> IsInfoSet<M> create() { return new IsInfoSet<M>() { final Set<M> infoSet = new LinkedHashSet<>(); @Override public Set<M> getInfoMessages() { return this.infoSet; } }; }
From source file:Simulator.PerformanceCalculation.java
public JPanel waitTime1() { LinkedHashSet no = new LinkedHashSet(); LinkedHashMap<Integer, ArrayList<Double>> wait1 = new LinkedHashMap<>(); for (Map.Entry<Integer, TraceObject> entry : l.getLocalTrace().entrySet()) { TraceObject traceObject = entry.getValue(); if (wait1.get(traceObject.getSurgeonId()) == null) { ArrayList details = new ArrayList(); details.add(traceObject.getWaitTime1()); wait1.put(traceObject.getSurgeonId(), details); } else {// w w w . j a v a2 s. c om wait1.get(traceObject.getSurgeonId()).add(traceObject.getWaitTime1()); } no.add(traceObject.getSurgeonId()); } String[] column = new String[no.size()]; String series1 = "Wait Time 1"; for (int i = 0; i < no.size(); i++) { column[i] = "Surgeon " + (i + 1); } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); LinkedHashMap<Integer, Double> average = new LinkedHashMap<>(); for (Map.Entry<Integer, ArrayList<Double>> entry : wait1.entrySet()) { Integer integer = entry.getKey(); ArrayList<Double> arrayList = entry.getValue(); double total = 0; for (Double double1 : arrayList) { total += double1; } average.put(integer, total / arrayList.size()); } for (int i = 1; i <= average.size(); i++) { dataset.addValue(Math.round(average.get(i) / 600), series1, column[i - 1]); } JFreeChart chart = ChartFactory.createBarChart("Wait Time 1", // chart title "Surgeon ID", // domain axis label "Days", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); return new ChartPanel(chart); }
From source file:de.vandermeer.skb.interfaces.messagesets.IsInfoSetFT.java
/** * Creates a new info set./*from w ww . j ava 2 s . c o m*/ * @return new info set */ static IsInfoSetFT create() { return new IsInfoSetFT() { final Set<FormattingTuple> infoSet = new LinkedHashSet<>(); @Override public Set<FormattingTuple> getInfoMessages() { return this.infoSet; } }; }