List of usage examples for java.util LinkedHashSet LinkedHashSet
public LinkedHashSet()
From source file:edu.uci.ics.jung.graph.OrderedSparseMultigraph.java
/** * Creates a new instance./*from ww w . j a v a2 s . c o m*/ */ public OrderedSparseMultigraph() { vertices = new LinkedHashMap<V, Pair<Set<E>>>(); edges = new LinkedHashMap<E, Pair<V>>(); directedEdges = new LinkedHashSet<E>(); }
From source file:com.enonic.cms.core.content.contentdata.custom.relationdataentrylistbased.AbstractRelationDataEntryListBasedInputDataEntry.java
public Collection<ContentKey> getRelatedContentKeys() { Set<ContentKey> keys = new LinkedHashSet<ContentKey>(); for (RelationDataEntry entry : entries) { if (entry.getContentKey() != null) { keys.add(entry.getContentKey()); }//www . jav a2s . c o m } return keys; }
From source file:com.google.gwt.emultest.java.util.LinkedHashSetTest.java
@SuppressWarnings("unchecked") public void testClone() { LinkedHashSet<String> srcSet = new LinkedHashSet<String>(); checkEmptyLinkedHashSetAssumptions(srcSet); // Check empty clone behavior LinkedHashSet<String> dstSet = (LinkedHashSet<String>) srcSet.clone(); assertNotNull(dstSet);/* w w w . j a v a 2 s. c om*/ assertEquals(dstSet.size(), srcSet.size()); assertEquals(dstSet.toArray(), srcSet.toArray()); // Check non-empty clone behavior srcSet.add(VALUE_1); srcSet.add(VALUE_2); srcSet.add(VALUE_3); srcSet.add(VALUE_4); dstSet = (LinkedHashSet<String>) srcSet.clone(); assertNotNull(dstSet); assertEquals(dstSet.size(), srcSet.size()); assertEquals(dstSet.toArray(), srcSet.toArray()); }
From source file:com.inmobi.grill.server.metastore.JAXBUtils.java
/** * Create a hive ql cube obejct from corresponding JAXB object * /*from ww w. j a v a 2s. com*/ * @param cube JAXB Cube * * @return {@link Cube} */ public static Cube hiveCubeFromXCube(XCube cube) { Set<CubeDimension> dims = new LinkedHashSet<CubeDimension>(); for (XDimension xd : cube.getDimensions().getDimensions()) { dims.add(hiveDimFromXDim(xd)); } Set<CubeMeasure> measures = new LinkedHashSet<CubeMeasure>(); for (XMeasure xm : cube.getMeasures().getMeasures()) { measures.add(hiveMeasureFromXMeasure(xm)); } Map<String, String> properties = mapFromXProperties(cube.getProperties()); double cubeWeight = cube.getWeight() == null ? 0d : cube.getWeight(); return new Cube(cube.getName(), measures, dims, properties, cubeWeight); }
From source file:com.autentia.tnt.manager.contacts.OfferManager.java
public Offer duplicateOffer(final Offer offer) { final Set<Interaction> interactions = new LinkedHashSet<Interaction>(); final Set<OfferRole> offerRoles = new LinkedHashSet<OfferRole>(); final Set<OfferCost> offerCosts = new LinkedHashSet<OfferCost>(); // copy simple data and delete identificative info final Offer duplicatedOffer = (Offer) SerializationUtils.clone(offer); duplicatedOffer.setId(null);/* w w w . j a va 2 s . co m*/ duplicatedOffer.setNumber(null); // copy interactions if (offer.getInteractions() != null) { for (Interaction interaction : offer.getInteractions()) { Interaction duplicatedInteraction = (Interaction) SerializationUtils.clone(interaction); duplicatedInteraction.setId(null); duplicatedInteraction.setOffer(duplicatedOffer); interactions.add(duplicatedInteraction); } } duplicatedOffer.setInteractions(interactions); // copy roles if (offer.getRoles() != null) { for (OfferRole offerRole : offer.getRoles()) { OfferRole duplicatedRole = (OfferRole) SerializationUtils.clone(offerRole); duplicatedRole.setId(null); duplicatedRole.setOffer(duplicatedOffer); offerRoles.add(duplicatedRole); } } duplicatedOffer.setRoles(offerRoles); // copy costs if (offer.getCosts() != null) { for (OfferCost offerCost : offer.getCosts()) { OfferCost duplicatedCost = (OfferCost) SerializationUtils.clone(offerCost); duplicatedCost.setId(null); duplicatedCost.setOffer(duplicatedOffer); offerCosts.add(duplicatedCost); } } duplicatedOffer.setCosts(offerCosts); return duplicatedOffer; }
From source file:gr.abiss.calipso.domain.SpaceRole.java
public SpaceRole() { this.userSpaceRoles = new LinkedHashSet<UserSpaceRole>(); this.roleSpaceStdFields = new LinkedHashSet<RoleSpaceStdField>(); }
From source file:de.vandermeer.skb.interfaces.coin.HeadsSuccessWithInfoAndWarnings.java
/** * Creates a new success coin with given value and information. * @param <R> type of the return value * @param <M> the message type for the set * @param value the actual return value//w ww . jav a 2s .c o m * @return new success coin */ static <R, M> HeadsSuccessWithInfoAndWarnings<R, M> create(final R value) { return new HeadsSuccessWithInfoAndWarnings<R, M>() { final Set<M> infoSet = new LinkedHashSet<>(); final Set<M> warningSet = new LinkedHashSet<>(); @Override public R getReturn() { return value; } @Override public Set<M> getInfoMessages() { return this.infoSet; } @Override public Set<M> getWarningMessages() { return this.warningSet; } }; }
From source file:org.eclipse.virgo.ide.jdt.internal.ui.actions.RefreshServerClasspathContainerActionDelegate.java
public void run(IAction action) { Set<IJavaProject> projects = new LinkedHashSet<IJavaProject>(); Iterator<IProject> iter = selected.iterator(); while (iter.hasNext()) { IProject project = iter.next();/* ww w . j av a2s .c om*/ if (FacetUtils.isBundleProject(project)) { projects.add(JdtUtils.getJavaProject(project)); } else if (FacetUtils.isParProject(project)) { for (IProject bundle : FacetUtils.getBundleProjects(project)) { projects.add(JdtUtils.getJavaProject(bundle)); } } } for (IJavaProject javaProject : projects) { ServerClasspathContainerUpdateJob.scheduleClasspathContainerUpdateJob(javaProject, BundleManifestManager.IMPORTS_CHANGED); } }
From source file:de.tudarmstadt.ukp.dkpro.core.testing.validation.CasValidator.java
public void setChecks(Class<? extends Check>... aChecks) { checks = new LinkedHashSet<>(); if (aChecks != null) { checks.addAll(asList(aChecks));//w w w .j a v a 2 s .c o m } }
From source file:org.hsweb.web.service.impl.form.validator.java.JavaDycBeanValidator.java
public boolean validateMap(Map<Object, Object> data, Operation operation) { ValidateResults results = new ValidateResults(); try {//w w w .jav a2s .c om Object validatorTarget = clazz.newInstance(); Set<ConstraintViolation<Object>> result = new LinkedHashSet<>(); if (operation == Operation.INSERT) { data.forEach((key, value) -> { try { BeanUtils.setProperty(validatorTarget, (String) key, value); } catch (Exception e) { } }); result.addAll(hibernateValidator.validate(validatorTarget)); } else data.forEach((key, value) -> { Field field = ReflectionUtils.findField(clazz, (String) key); if (field != null) result.addAll(hibernateValidator.validateValue(clazz, (String) key, value)); }); if (result.size() > 0) { for (ConstraintViolation<Object> violation : result) { String property = violation.getPropertyPath().toString(); results.addResult(property, violation.getMessage()); } } } catch (Exception e) { throw new BusinessException("??", e, 500); } if (results.size() > 0) throw new ValidationException(results.get(0).getMessage(), results); return true; }