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:edu.ur.file.mime.InMemoryMimeTypeService.java

/**
 * Get the set of mime top media types.  Returns an
 * unmodifiable set.// w  w  w  . j  av  a2 s  . co  m
 * 
 * @return
 */
public Set<TopMediaType> getTopMediaTypes() {
    return Collections.unmodifiableSet(topMediaTypes);
}

From source file:com.cronutils.model.field.constraint.FieldConstraints.java

/**
 * @param specialChars/*  w ww. j a v a  2s  .  c om*/
 *            - allowed special chars
 * @param startRange
 *            - lowest possible value
 * @param endRange
 *            - highest possible value
 */
public FieldConstraints(Map<String, Integer> stringMapping, Map<Integer, Integer> intMapping,
        Set<SpecialChar> specialChars, int startRange, int endRange) {
    this.stringMapping = Collections
            .unmodifiableMap(Validate.notNull(stringMapping, "String mapping must not be null"));
    this.intMapping = Collections
            .unmodifiableMap(Validate.notNull(intMapping, "Integer mapping must not be null"));
    this.specialChars = Collections.unmodifiableSet(
            Validate.notNull(specialChars, "Special (non-standard) chars set must not be null"));
    this.startRange = startRange;
    this.endRange = endRange;
}

From source file:enumsupport.reverselookupmapfactory.DeduplicatdeNumberSetFactory.java

/**
 *
 * @param numberRange ???/*from   ww w  .j a  v  a  2 s.com*/
 * @param number  null??
 * @param numbers ??????null??????
 * @return ????(??)
 * @throws NullPointerException ?????null?????
 * @throws IllegalArgumentException ??numberrange???????
 */
public Set<T> makeSet(Range<T> numberRange, T number, T... numbers)
        throws NullPointerException, IllegalArgumentException {

    List<T> t = new ArrayList<>();
    t.add(number);

    if (numbers != null) {
        t.addAll(Arrays.asList(numbers));
    }
    for (T num : t) {
        if (num == null) {
            throw new IllegalArgumentException("?null???????");
        }
        if (!numberRange.contains(num)) {
            MessageFormat msg = new MessageFormat(
                    "????????????={0}");
            Object[] parameters = { num };
            throw new IllegalArgumentException(msg.format(parameters));
        }
    }
    Set<T> numberSet_t = Collections.synchronizedSet(new HashSet<>());
    numberSet_t.addAll(t);
    return Collections.unmodifiableSet(numberSet_t);
}

From source file:me.m1key.audiolicious.domain.entities.Artist.java

public Set<Album> getAlbums() {
    return Collections.unmodifiableSet(albums);
}

From source file:net.dv8tion.jda.core.utils.cache.impl.AbstractCacheView.java

@Override
public Set<T> asSet() {
    HashSet<T> set = new HashSet<>(elements.size());
    elements.forEachValue(set::add);/*from w  w  w .  j  av a 2  s.  c  o  m*/
    return Collections.unmodifiableSet(set);
}

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

@NotNull
public Set<ListItem> getItems() {
    return Collections.unmodifiableSet(this.items);
}

From source file:net.dv8tion.jda.bot.utils.cache.impl.ShardCacheViewImpl.java

@Override
public Set<JDA> asSet() {
    return Collections.unmodifiableSet(new HashSet<>(elements.valueCollection()));
}

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

public Set<Tag> getTags() {
    return Collections.unmodifiableSet(tags);
}

From source file:edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions.java

private Actions(List<Set<RequestedAction>> oldList, Collection<RequestedAction> newActions) {
    List<Set<RequestedAction>> newList = new ArrayList<Set<RequestedAction>>();
    newList.addAll(oldList);/*from w  w  w .  j  a v  a  2  s  .  co m*/

    Set<RequestedAction> newActionSet = new HashSet<RequestedAction>(newActions);
    if (!newActionSet.isEmpty()) {
        newList.add(Collections.unmodifiableSet(newActionSet));
    }
    this.clauseList = Collections.unmodifiableList(newList);
}

From source file:io.netlibs.bgp.rib.TopologicalTreeSortingKey.java

public TopologicalTreeSortingKey(AddressFamilyKey addressFamilyKey, Collection<PathAttribute> attributes) {
    this.addressFamilyKey = addressFamilyKey;

    if (attributes != null)
        pathAttributes.addAll(attributes);

    pathAttributes = Collections.unmodifiableSet(pathAttributes);
}