Example usage for com.google.common.collect Sets newLinkedHashSet

List of usage examples for com.google.common.collect Sets newLinkedHashSet

Introduction

In this page you can find the example usage for com.google.common.collect Sets newLinkedHashSet.

Prototype

public static <E> LinkedHashSet<E> newLinkedHashSet() 

Source Link

Document

Creates a mutable, empty LinkedHashSet instance.

Usage

From source file:org.eclipse.emf.ecoretools.design.EcoreToolsViewpoints.java

public Set<Viewpoint> all() {
    Set<Viewpoint> ecoreToolsViewpoints = Sets.newLinkedHashSet();
    Viewpoint vp = design();/*from ww w  .java  2s  .c o m*/
    if (vp != null)
        ecoreToolsViewpoints.add(vp);
    vp = archetype();
    if (vp != null)
        ecoreToolsViewpoints.add(vp);
    vp = review();
    if (vp != null)
        ecoreToolsViewpoints.add(vp);
    vp = generation();
    if (vp != null)
        ecoreToolsViewpoints.add(vp);
    return ecoreToolsViewpoints;
}

From source file:org.jetbrains.kotlin.types.expressions.LabelResolver.java

@NotNull
private Set<KtElement> getElementsByLabelName(@NotNull Name labelName,
        @NotNull KtSimpleNameExpression labelExpression) {
    Set<KtElement> elements = Sets.newLinkedHashSet();
    PsiElement parent = labelExpression.getParent();
    while (parent != null) {
        Name name = getLabelNameIfAny(parent);
        if (name != null && name.equals(labelName)) {
            elements.add(getExpressionUnderLabel((KtExpression) parent));
        }//www  .j  a v a 2s .c om
        parent = parent.getParent();
    }
    return elements;
}

From source file:com.mysema.query.util.CollectionUtils.java

public static <T> Set<T> addSorted(Set<T> set, T element) {
    final int size = set.size();
    if (size == 0) {
        return ImmutableSet.of(element);
    } else if (set instanceof ImmutableSet) {
        if (size == 1) {
            final T val = set.iterator().next();
            set = Sets.newLinkedHashSet();
            set.add(val);
        } else {/*from  w  w w. j a va2 s .c o  m*/
            set = Sets.newLinkedHashSet(set);
        }
    }
    set.add(element);
    return set;
}

From source file:uk.ac.ebi.atlas.model.ExperimentConfiguration.java

public Set<Contrast> getContrasts() {

    Set<Contrast> contrasts = Sets.newLinkedHashSet();

    NodeList arrayDesigns = document.getElementsByTagName("array_design");
    for (int i = 0; i < arrayDesigns.getLength(); i++) {
        Node currentArrayDesign = arrayDesigns.item(i);
        String arrayDesignAccession = currentArrayDesign.getFirstChild().getTextContent().trim();
        parseContrastConfiguration("analytics[" + (i + 1) + "]/contrasts/contrast/@id", arrayDesignAccession,
                contrasts);//www  .j  a  v  a 2  s. c o m
    }

    // in case no array designs (case of RNA-seq)
    if (arrayDesigns.getLength() == 0) {
        parseContrastConfiguration("analytics/contrasts/contrast/@id", null, contrasts);
    }

    return contrasts;
}

From source file:com.google.publicalerts.cap.validator.ValidationResult.java

/**
 * Creates a new validation result.//w  ww.j ava 2s  . c o  m
 *
 * @param xml the XML of the document being validated
 */
public ValidationResult(String xml) {
    this.xml = xml;
    this.validationMessages = Sets.newLinkedHashSet();
    this.validAlerts = Lists.newArrayList();
    this.timing = new Timing();
}

From source file:org.des.tao.ide.EventRelationshipGraph.java

public EventRelationshipGraph() {
    super();//w w w .ja va 2  s . c om

    events = Sets.newLinkedHashSet();
    selectedComponents = Sets.newLinkedHashSet();
    adjacencyList = HashBasedTable.create();

    run = new Event("Run", eventCount++, new Point2D.Double(50, 50));
    events.add(run);

    Timer frameTimer = new Timer(REFRESH_INTERVAL, new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            repaint();
        }
    });

    frameTimer.setRepeats(true);
    frameTimer.start();
}

From source file:cc.recommenders.usages.AbstractUsage.java

/**
 * @return concatenation of paths of the underlying usage, which contains
 *         each parameter callsite exactly once
 *///  w w w . j  a  va  2s  .  co  m
public Set<CallSite> getParameterCallsites() {
    Set<CallSite> filtered = Sets.newLinkedHashSet();
    for (CallSite site : getAllCallsites()) {
        boolean isReceiverCall = site.getKind().equals(CallSiteKind.PARAMETER);
        if (isReceiverCall) {
            filtered.add(site);
        }
    }
    return filtered;
}

From source file:org.jclouds.atmos.domain.UserMetadata.java

public UserMetadata() {
    this.metadata = Maps.newLinkedHashMap();
    this.listableMetadata = Maps.newLinkedHashMap();
    this.tags = Sets.newLinkedHashSet();
    this.listableTags = Sets.newLinkedHashSet();
}

From source file:it.infn.mw.iam.core.IamTokenService.java

@Override
public Set<OAuth2AccessTokenEntity> getAllAccessTokensForUser(String id) {

    Set<OAuth2AccessTokenEntity> results = Sets.newLinkedHashSet();
    results.addAll(accessTokenRepo.findValidAccessTokensForUser(id, new Date()));
    return results;
}

From source file:org.eclipse.sirius.diagram.editor.tools.internal.menu.refactoring.DiagramRefactoringMenu.java

private Collection generateRefactoringActions(final ISelection selection, final IEditorPart editor) {

    // We first build all candidate Actions
    Set<AbstractEObjectRefactoringAction> allActions = Sets.newLinkedHashSet();
    allActions.add(new BorderRefactoringAction(editor, selection));
    allActions.add(new EdgeMappingRefactoringAction(editor, selection));

    // We only add to the menu the actions that have a valid selection
    return Sets.filter(allActions, new Predicate<AbstractEObjectRefactoringAction>() {

        public boolean apply(AbstractEObjectRefactoringAction candidateAction) {
            return candidateAction.isSelectionValid();
        }// www  . j  ava2  s  . c  o  m
    });
}