Example usage for java.util Collections unmodifiableSet

List of usage examples for java.util Collections unmodifiableSet

Introduction

In this page you can find the example usage for java.util Collections unmodifiableSet.

Prototype

public static <T> Set<T> unmodifiableSet(Set<? extends T> s) 

Source Link

Document

Returns an unmodifiable view of the specified set.

Usage

From source file:com.mgmtp.jfunk.data.generator.data.FieldSet.java

public Set<String> getDependencies() {
    return Collections.unmodifiableSet(dependencies);
}

From source file:edu.uci.ics.jung.utils.PredicateUtils.java

/**
 * Returns a <code>Set</code> consisting of all edges <code>e</code> 
 * in graph <code>g</code> that satisfy predicate <code>p</code>,
 * that is, those for which <code>p.evaluate(e)</code> returns true.
 *///w w  w.jav  a  2 s. c  om
public static Set getEdges(ArchetypeGraph g, Predicate p) {
    SubsetManager sm = (SubsetManager) g.getUserDatum(ArchetypeGraph.SUBSET_MANAGER);
    if (sm != null) {
        Set s = sm.getEdges(p);
        if (s != null)
            return s;
    }

    Set s = new HashSet();
    Set edges = g.getEdges();
    for (Iterator e_it = edges.iterator(); e_it.hasNext();) {
        ArchetypeEdge e = (ArchetypeEdge) e_it.next();
        if (p.evaluate(e))
            s.add(e);
    }
    return Collections.unmodifiableSet(s);
}

From source file:edu.umd.cs.psl.model.kernel.predicateconstraint.GroundSymmetryConstraint.java

public GroundSymmetryConstraint(ConstraintKernel k, GroundAtom a, GroundAtom b) {
    kernel = k;/*from w  ww  .  j  a  v  a 2s  .co  m*/
    atomA = a;
    atomB = b;

    Set<GroundAtom> tempAtoms = new HashSet<GroundAtom>();
    tempAtoms.add(atomA);
    tempAtoms.add(atomB);
    atoms = Collections.unmodifiableSet(tempAtoms);

    hashcode = new HashCodeBuilder().append(kernel).append(atomA).append(atomB).toHashCode()
            + new HashCodeBuilder().append(kernel).append(atomB).append(atomA).toHashCode();

    /* Must register after all the members (like the hashcode!) are set */
    atomA.registerGroundKernel(this);
    atomB.registerGroundKernel(this);
}

From source file:org.web4thejob.orm.UniqueKeyConstraintImpl.java

public UniqueKeyConstraintImpl(EntityMetadata entityMetadata, UniqueKey uniqueKey) {
    this.entityMetadata = entityMetadata;

    Set<PropertyMetadata> temp = new HashSet<PropertyMetadata>();
    for (Iterator<?> iterCols = uniqueKey.getColumnIterator(); iterCols.hasNext();) {
        Column column = (Column) iterCols.next();
        PropertyMetadata propertyMetadata = getPropertyForColumn(column);
        if (propertyMetadata != null) {
            temp.add(propertyMetadata);//from ww  w .  j a va  2  s  . com
        }
    }

    propertyMetadatas = Collections.unmodifiableSet(temp);
}

From source file:io.curly.gathering.list.GatheringList.java

@NotNull
public Set<UserParticipant> getParticipants() {
    return Collections.unmodifiableSet(this.participants);
}

From source file:com.qcadoo.mes.basic.shift.WorkingHours.java

public WorkingHours(final String hourRanges) {
    hours = Sets.newTreeSet(Collections.unmodifiableSet(parseIntervals(hourRanges)));
}

From source file:com.oreilly.springdata.neo4j.core.Customer.java

public Set<Address> getAddresses() {
    return Collections.unmodifiableSet(addresses);
}

From source file:fll.db.NonNumericNominees.java

/**
 * Numbers of the teams that are the nominees.
 * //from  w ww  .  j  a  v  a2s.c  o  m
 * @return read-only set
 */
public Set<Integer> getTeamNumbers() {
    return Collections.unmodifiableSet(mTeamNumbers);
}

From source file:com.travelport.restneohack.model.domain.AccountView.java

public Set<PaymentType> getLineItems() {
    return Collections.unmodifiableSet(lineItems);
}

From source file:ar.com.zauber.labs.kraken.providers.wikipedia.model.impl.SimpleWikiPage.java

/** Creates the SimpleWikiPage. */
public SimpleWikiPage(final long pageId, final Language lang, final Set<String> titles,
        final Map<Language, WikiPage> langTitles) {

    Validate.notNull(lang, "null language");
    Validate.notNull(titles, "null titles");
    Validate.isTrue(titles.size() > 0, "wiki page must have at least one title");
    for (final String title : titles) {
        Validate.isTrue(StringUtils.isNotBlank(title), "invalid title");
    }/*from ww  w .j av a  2s  .c om*/

    for (final Map.Entry<Language, WikiPage> langTitle : langTitles.entrySet()) {
        Validate.notNull(langTitle.getKey());
        Validate.notNull(langTitle.getValue());
    }

    this.pageId = pageId;
    this.lang = lang;
    this.titles = Collections.unmodifiableSet(titles);
    this.langTitles = Collections.unmodifiableMap(langTitles);
}