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:org.apache.nifi.processors.msgpack.MessagePackPack.java

@Override
protected void init(final ProcessorInitializationContext context) {
    final List<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>();
    descriptors.add(INPUT_FORMAT);//from  w w w.  ja v a  2 s .co  m
    this.descriptors = Collections.unmodifiableList(descriptors);

    final Set<Relationship> relationships = new HashSet<Relationship>();
    relationships.add(REL_SUCCESS);
    relationships.add(REL_FAILURE);
    this.relationships = Collections.unmodifiableSet(relationships);
}

From source file:com.github.mrstampy.gameboot.metrics.GameBootMetricsHelper.java

@Override
public Set<Entry<String, Timer>> getTimers() {
    return Collections.unmodifiableSet(timers.entrySet());
}

From source file:net.sourceforge.fenixedu.domain.accounting.AccountingTransaction.java

@Override
public Set<Entry> getEntriesSet() {
    return Collections.unmodifiableSet(super.getEntriesSet());
}

From source file:com.opensymphony.xwork2.ognl.OgnlUtil.java

@Inject(value = XWorkConstants.OGNL_EXCLUDED_CLASSES, required = false)
public void setExcludedClasses(String commaDelimitedClasses) {
    Set<String> classNames = TextParseUtil.commaDelimitedStringToSet(commaDelimitedClasses);
    Set<Class<?>> classes = new HashSet<>();

    for (String className : classNames) {
        try {/*from w  w w  .j  a  v a 2s.  co  m*/
            classes.add(Class.forName(className));
        } catch (ClassNotFoundException e) {
            throw new ConfigurationException("Cannot load excluded class: " + className, e);
        }
    }

    excludedClasses = Collections.unmodifiableSet(classes);
}

From source file:com.jeremydyer.nifi.CropImageProcessor.java

@Override
protected void init(final ProcessorInitializationContext context) {
    final List<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>();
    descriptors.add(X_POINT);//from   w  w w  .  j ava  2s.  com
    descriptors.add(Y_POINT);
    descriptors.add(CROP_WIDTH);
    descriptors.add(CROP_HEIGHT);
    this.descriptors = Collections.unmodifiableList(descriptors);

    final Set<Relationship> relationships = new HashSet<Relationship>();
    relationships.add(REL_ORIGINAL);
    relationships.add(REL_CROPPED_IMAGE);
    relationships.add(REL_FAILURE);
    this.relationships = Collections.unmodifiableSet(relationships);

    //Load the OpenCV Native Library
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
}

From source file:com.tamingtext.classifier.mlt.MoreLikeThisCategorizer.java

public Collection<String> getCategories() {
    return Collections.unmodifiableSet(categories);
}

From source file:com.github.gaoyangthu.core.hbase.HbaseSynchronizationManager.java

/**
 * Returns the bound tables (by name)./*from  www. j  av  a  2s.  co  m*/
 * 
 * @return names of bound tables
 */
public static Set<String> getTableNames() {
    Map<String, HTableInterface> map = resources.get();
    if (map != null && !map.isEmpty()) {
        return Collections.unmodifiableSet(map.keySet());
    }
    return Collections.emptySet();
}

From source file:fr.gael.dhus.olingo.v1.map.AbstractFunctionalMap.java

@Override
public Set<Map.Entry<K, V>> entrySet() {
    return Collections.unmodifiableSet(sourceMap.entrySet());
}

From source file:com.ning.maven.plugins.duplicatefinder.ClasspathDescriptor.java

public Set getElementsHavingResource(String resource) {
    Set elements = (Set) resourcesWithElements.get(resource);

    return elements == null ? null : Collections.unmodifiableSet(elements);
}

From source file:com.yahoo.bard.webservice.data.metric.TemplateDruidQuery.java

/**
 * Template Query constructor for a nested template query with a bound time grain.
 *
 * @param aggregations  aggregations for this query template
 * @param postAggregations  post aggregations for this query template
 * @param nestedQuery  A query which this query uses as a data source
 * @param timeGrain  The time grain constraint on the query if any
 */// w  w w  .java 2s .c  o m
public TemplateDruidQuery(Collection<Aggregation> aggregations, Collection<PostAggregation> postAggregations,
        TemplateDruidQuery nestedQuery, ZonelessTimeGrain timeGrain) {
    // Convert the sets to LinkedHashSet to preserve order, and then make them unmodifiable
    this.aggregations = Collections.unmodifiableSet(new LinkedHashSet<>(aggregations));
    this.postAggregations = Collections.unmodifiableSet(new LinkedHashSet<>(postAggregations));
    this.nestedQuery = nestedQuery;
    this.timeGrain = timeGrain;

    // Check for duplicate field names
    Set<String> nameCollisions = getNameCollisions(aggregations, postAggregations);
    if (!nameCollisions.isEmpty()) {
        String message = "Duplicate name in aggregation & post aggregations: " + nameCollisions;
        LOG.error(message);
        throw new IllegalArgumentException(message);
    }

    depth = calculateDepth(this);
}