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:ddf.catalog.data.impl.InjectableAttributeImpl.java

@Override
public Set<String> metacardTypes() {
    return Collections.unmodifiableSet(metacardTypes);
}

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

public Set<GrantedAuthority> getGroups() {
    return Collections.unmodifiableSet(groups);
}

From source file:ddf.catalog.validation.impl.violation.ValidationViolationImpl.java

/**
 * Creates a {@code ValidationViolationImpl} with the specified attribute(s), message, and
 * severity./*from w ww . jav  a 2 s.c  o m*/
 *
 * @param attributes the attribute(s) involved in the violation, cannot be null or empty
 * @param message    the message describing the violation, cannot be null, empty, or blank
 * @param severity   the severity of the violation, cannot be null
 * @throws IllegalArgumentException if any of the parameters are null, empty, or blank
 */
public ValidationViolationImpl(final Set<String> attributes, final String message, final Severity severity) {
    Preconditions.checkArgument(CollectionUtils.isNotEmpty(attributes), "Must specify at least one attribute.");
    Preconditions.checkArgument(StringUtils.isNotBlank(message),
            "The message cannot be null, empty, or blank.");
    Preconditions.checkArgument(severity != null, "The severity cannot be null.");

    this.attributes = Collections.unmodifiableSet(attributes);
    this.message = message;
    this.severity = severity;
}

From source file:de.fuberlin.wiwiss.r2r.TargetPattern.java

public Set<String> getVariableDependencies() {
    return Collections.unmodifiableSet(variableDependencies);
}

From source file:org.jasig.portlet.survey.service.dto.ResponseAnswerDTO.java

public Set<Long> getAnswer() {
    return Collections.unmodifiableSet(answer);
}

From source file:fr.openwide.nuxeo.formatter.FieldFormatterServiceImpl.java

@Override
public Set<String> getPatternNames() {
    return Collections.unmodifiableSet(patterns.keySet());
}

From source file:Main.java

/**
 * Creates an unmodifiable shallow copy of the given original {@link Set}. <p> While the copy returns an immutable
 * copy of the {@link Set} the content is not cloned in any way. Unless the content is immutable by itself the
 * result is not fully immutable. In the shallow copy all references are the same as in the original {@link Set}!
 * </p>/*from   w w  w . ja  v  a  2s . c o  m*/
 *
 * @param original The {@link Set} to copy the elements fro.
 * @param <E>      The type of the elements
 *
 * @return Returns an immutable (unmodifiable) copy of the original {@link Set} with all the elements added but not
 * cloned!
 */
public static <E> Set<E> createUnmodifiableShallowCopy(final Set<E> original) {
    if (original == null || original.isEmpty()) {
        return Collections.emptySet();
    } else {
        return Collections.unmodifiableSet(new HashSet<E>(original));
    }
}

From source file:com.omricat.yacc.data.model.CurrencyDataset.java

/**
 * Instantiates a currencies list object.
 * @param currencies array of {@link com.omricat.yacc.data.model.Currency}
 *                   objects. May be empty, but not null.
 * @param lastUpdatedTimestamp unix epoch timestamp indicating the last
 *                             time the list of currencies was updated.
 *                             Must be non-negative.
 */// www  .j  a v a 2  s  .c  o  m
@JsonCreator
public CurrencyDataset(@JsonProperty(CURRENCIES) @NotNull final Set<Currency> currencies,
        @JsonProperty(TIMESTAMP) final long lastUpdatedTimestamp) {
    checkArgument(lastUpdatedTimestamp >= 0);
    this.currencies = Collections.unmodifiableSet(checkNotNull(currencies));
    this.lastUpdatedTimestamp = lastUpdatedTimestamp;
}

From source file:ch.rasc.wampspring.method.DestinationPatternsMessageCondition.java

private DestinationPatternsMessageCondition(Collection<String> patterns, PathMatcher pathMatcher) {
    Assert.notNull(pathMatcher, "pathMatcher is required");

    this.pathMatcher = pathMatcher;
    this.patterns = Collections.unmodifiableSet(new LinkedHashSet<>(patterns));
}

From source file:com.cronutils.model.definition.CronDefinition.java

/**
 * Constructor/*from   w  w w .  j  av a 2  s. co m*/
 * @param fieldDefinitions - list with field definitions. Must not be null or empty.
 *                         Throws a NullPointerException if a null values is received
 *                         Throws an IllegalArgumentException if an empty list is received
 * @param lastFieldOptional - boolean, value stating if last field is optional
 */
public CronDefinition(List<FieldDefinition> fieldDefinitions, Set<CronConstraint> cronConstraints,
        boolean lastFieldOptional, boolean strictRanges) {
    Validate.notNull(fieldDefinitions, "Field definitions must not be null");
    Validate.notNull(cronConstraints, "Cron validations must not be null");
    Validate.notEmpty(fieldDefinitions, "Field definitions must not be empty");
    if (lastFieldOptional) {
        Validate.isTrue(fieldDefinitions.size() > 1,
                "If last field is optional, field definition must hold at least two fields");
    }
    this.fieldDefinitions = Maps.newHashMap();
    for (FieldDefinition field : fieldDefinitions) {
        this.fieldDefinitions.put(field.getFieldName(), field);
    }
    this.cronConstraints = Collections.unmodifiableSet(cronConstraints);
    this.lastFieldOptional = lastFieldOptional;
    this.strictRanges = strictRanges;
}