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:de.kaiserpfalzEdv.office.contacts.contact.ContactDO.java

@Override
public Set<AddressDO> getAddresses() {
    return Collections.unmodifiableSet(addresses);
}

From source file:net.sf.gazpachoquest.dto.QuestionnaireDefinitionDTO.java

public Set<Language> getSupportedLanguages() {
    return Collections.unmodifiableSet(supportedLanguages);
}

From source file:org.opendatakit.security.spring.UserImpl.java

public Set<GrantedAuthority> getDirectAuthorities() {
    return Collections.unmodifiableSet(directAuthorities);
}

From source file:ca.uhn.fhir.context.RuntimeSearchParam.java

public RuntimeSearchParam(IIdType theId, String theUri, String theName, String theDescription, String thePath,
        RestSearchParameterTypeEnum theParamType, List<RuntimeSearchParam> theCompositeOf,
        Set<String> theProvidesMembershipInCompartments, Set<String> theTargets,
        RuntimeSearchParamStatusEnum theStatus) {
    super();//from  w  w  w .  j  a v  a  2  s .  c om
    myId = theId;
    myUri = theUri;
    myName = theName;
    myDescription = theDescription;
    myPath = thePath;
    myParamType = theParamType;
    myCompositeOf = theCompositeOf;
    myStatus = theStatus;
    if (theProvidesMembershipInCompartments != null && !theProvidesMembershipInCompartments.isEmpty()) {
        myProvidesMembershipInCompartments = Collections.unmodifiableSet(theProvidesMembershipInCompartments);
    } else {
        myProvidesMembershipInCompartments = null;
    }
    if (theTargets != null && theTargets.isEmpty() == false) {
        myTargets = Collections.unmodifiableSet(theTargets);
    } else {
        myTargets = null;
    }

    HashSet<String> base = new HashSet<String>();
    int indexOf = thePath.indexOf('.');
    if (indexOf != -1) {
        base.add(trim(thePath.substring(0, indexOf)));
    }
    myBase = Collections.unmodifiableSet(base);
}

From source file:net.sourceforge.fenixedu.presentationTier.util.CollectionFilter.java

public Set<T> filter(Set<T> elements) {
    Set<T> filtered;//from  ww w .jav a2  s .c om

    if (comparator == null) {
        filtered = new HashSet<T>();
    } else {
        filtered = new TreeSet<T>(comparator);
    }

    final Set<Predicate> predicates = getPredicates();

    if (predicates == null || predicates.isEmpty()) {
        filtered.addAll(elements);
        return Collections.unmodifiableSet(filtered);
    }
    Predicate predicate;
    if (predicates.size() == 1) {
        predicate = predicates.iterator().next();
    } else {
        predicate = AllPredicate.getInstance(predicates);
    }
    for (T element : elements) {
        if (predicate.evaluate(element)) {
            filtered.add(element);
        }
    }
    return Collections.unmodifiableSet(filtered);
}

From source file:ddf.catalog.validation.impl.AttributeValidatorRegistryImpl.java

@Override
public Set<AttributeValidator> getValidators(final String attributeName) {
    Preconditions.checkArgument(attributeName != null, "The attribute name cannot be null.");

    return Collections
            .unmodifiableSet(attributeValidatorMap.getOrDefault(attributeName, Collections.emptySet()));
}

From source file:edu.umich.flowfence.service.NamespaceSharedPrefs.java

public static NamespaceSharedPrefs get(SharedPreferences basePrefs, String taintSetNamespace,
        String... taintNamespaces) {
    Objects.requireNonNull(taintSetNamespace);
    taintNamespaces = ArrayUtils.nullToEmpty(taintNamespaces);
    if (taintNamespaces.length == 0) {
        throw new IllegalArgumentException("Need at least one taint namespace!");
    }/* ww  w  . j av a 2 s  .c o m*/
    Set<String> taintNamespaceSet = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(taintNamespaces)));
    if (taintNamespaceSet.contains(taintSetNamespace)) {
        throw new IllegalArgumentException("Taint set namespace also a taint namespace");
    }
    synchronized (g_mPrefsLookup) {
        NamespaceSharedPrefs prefsStrong = null;
        WeakReference<NamespaceSharedPrefs> prefsWeak = g_mPrefsLookup.get(basePrefs);
        if (prefsWeak != null) {
            prefsStrong = prefsWeak.get();
        }
        if (prefsStrong != null) {
            if (!taintSetNamespace.equals(prefsStrong.mTaintSetNamespace)
                    || !taintNamespaceSet.equals(prefsStrong.mTaintNamespaces)) {
                Log.w(TAG,
                        String.format(
                                "Inconsistent initialization: "
                                        + "initialized with TS=%s T=%s, retrieved with TS=%s T=%s",
                                prefsStrong.mTaintSetNamespace, prefsStrong.mTaintNamespaces, taintSetNamespace,
                                taintNamespaceSet));
            }
        } else {
            prefsStrong = new NamespaceSharedPrefs(basePrefs, taintSetNamespace, taintNamespaceSet);
            prefsWeak = new WeakReference<>(prefsStrong);
            g_mPrefsLookup.put(basePrefs, prefsWeak);
        }
        return prefsStrong;
    }
}

From source file:fr.keemto.scheduling.TaskScheduler.java

public Set<ScheduledTask> getScheduledTasks() {
    return Collections.unmodifiableSet(scheduledTasks);
}

From source file:com.mirth.connect.userutil.MessageHeaders.java

/**
 * Get all header keys.
 * 
 * @return A set of all header keys.
 */
public Set<String> getKeys() {
    return Collections.unmodifiableSet(delegate.keySet());
}

From source file:com.taobao.ad.easyschedule.security.ActionSecurityBean.java

/**
 * ?
 * 
 * @return Set<Method>
 */
public Set<Method> getOperationMethodSet() {
    return Collections.unmodifiableSet(methodIndex.keySet());
}