Tabnine Logo
Collections.unmodifiableSet
Code IndexAdd Tabnine to your IDE (free)

How to use
unmodifiableSet
method
in
java.util.Collections

Best Java code snippets using java.util.Collections.unmodifiableSet (Showing top 20 results out of 37,827)

Refine searchRefine arrow

  • Set.add
  • Map.keySet
  • Collections.emptySet
  • List.add
  • Map.put
  • Collections.unmodifiableList
origin: spring-projects/spring-framework

/**
 * Return the set of all option arguments present on the command line.
 */
public Set<String> getOptionNames() {
  return Collections.unmodifiableSet(this.optionArgs.keySet());
}
origin: square/retrofit

 private static Set<? extends Annotation> jsonAnnotations(Annotation[] annotations) {
  Set<Annotation> result = null;
  for (Annotation annotation : annotations) {
   if (annotation.annotationType().isAnnotationPresent(JsonQualifier.class)) {
    if (result == null) result = new LinkedHashSet<>();
    result.add(annotation);
   }
  }
  return result != null ? unmodifiableSet(result) : Collections.<Annotation>emptySet();
 }
}
origin: spring-projects/spring-framework

public MethodNotAllowedException(String method, @Nullable Collection<HttpMethod> supportedMethods) {
  super(HttpStatus.METHOD_NOT_ALLOWED, "Request method '" + method + "' not supported");
  Assert.notNull(method, "'method' is required");
  if (supportedMethods == null) {
    supportedMethods = Collections.emptySet();
  }
  this.method = method;
  this.supportedMethods = Collections.unmodifiableSet(new HashSet<>(supportedMethods));
}
origin: apache/nifi

@Override
protected void init(final ProcessorInitializationContext context) {
  final List<PropertyDescriptor> properties = new ArrayList<>();
  properties.add(USE_FILENAME_IN_DETECTION);
  this.properties = Collections.unmodifiableList(properties);
  final Set<Relationship> rels = new HashSet<>();
  rels.add(REL_SUCCESS);
  this.relationships = Collections.unmodifiableSet(rels);
}
origin: dropwizard/dropwizard

  public static <T> Set<T> of(Iterable<T> elements) {
    final Set<T> set = new HashSet<>();
    for (T element : elements) {
      set.add(element);
    }
    return unmodifiableSet(set);
  }
}
origin: spring-projects/spring-framework

/**
 * Update the exposed {@link #cacheNames} set with the given name.
 * <p>This will always be called within a full {@link #cacheMap} lock
 * and effectively behaves like a {@code CopyOnWriteArraySet} with
 * preserved order but exposed as an unmodifiable reference.
 * @param name the name of the cache to be added
 */
private void updateCacheNames(String name) {
  Set<String> cacheNames = new LinkedHashSet<>(this.cacheNames.size() + 1);
  cacheNames.addAll(this.cacheNames);
  cacheNames.add(name);
  this.cacheNames = Collections.unmodifiableSet(cacheNames);
}
origin: org.osgi/org.osgi.core

public Set<Map.Entry<String, Object>> entrySet() {
  if (entries != null) {
    return entries;
  }
  Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(properties.entrySet());
  add: for (String key : service.getPropertyKeys()) {
    for (String k : properties.keySet()) {
      if (key.equalsIgnoreCase(k)) {
        continue add;
      }
    }
    all.add(new Entry(key, service.getProperty(key)));
  }
  return entries = Collections.unmodifiableSet(all);
}
origin: apache/nifi

@Override
protected void init(final ProcessorInitializationContext context) {
  final Set<Relationship> relationships = new HashSet<>();
  relationships.add(REL_ATTACHMENTS);
  relationships.add(REL_ORIGINAL);
  relationships.add(REL_FAILURE);
  this.relationships = Collections.unmodifiableSet(relationships);
  final List<PropertyDescriptor> descriptors = new ArrayList<>();
  this.descriptors = Collections.unmodifiableList(descriptors);
}
origin: MovingBlocks/Terasology

/**
 * @param uri the uri to look uo
 * @return a set that contains all keys for that uri, never <code>null</code>
 */
public Set<String> getModuleConfigKeys(SimpleUri uri) {
  Map<String, JsonElement> map = config.getModuleConfigs().get(uri);
  if (map == null) {
    return Collections.emptySet();
  }
  return Collections.unmodifiableSet(map.keySet());
}
origin: spring-projects/spring-security

  @Override
  public void setupModule(SetupContext context) {
    SecurityJackson2Modules.enableDefaultTyping((ObjectMapper) context.getOwner());
    context.setMixInAnnotations(AnonymousAuthenticationToken.class, AnonymousAuthenticationTokenMixin.class);
    context.setMixInAnnotations(RememberMeAuthenticationToken.class, RememberMeAuthenticationTokenMixin.class);
    context.setMixInAnnotations(SimpleGrantedAuthority.class, SimpleGrantedAuthorityMixin.class);
    context.setMixInAnnotations(Collections.<Object>unmodifiableSet(Collections.emptySet()).getClass(), UnmodifiableSetMixin.class);
    context.setMixInAnnotations(Collections.<Object>unmodifiableList(Collections.emptyList()).getClass(), UnmodifiableListMixin.class);
    context.setMixInAnnotations(User.class, UserMixin.class);
    context.setMixInAnnotations(UsernamePasswordAuthenticationToken.class, UsernamePasswordAuthenticationTokenMixin.class);
    context.setMixInAnnotations(BadCredentialsException.class, BadCredentialsExceptionMixin.class);
  }
}
origin: apache/nifi

@Override
protected void init(final ProcessorInitializationContext context) {
  final List<PropertyDescriptor> properties = new ArrayList<>();
  properties.add(MODE);
  this.properties = Collections.unmodifiableList(properties);
  final Set<Relationship> relationships = new HashSet<>();
  relationships.add(REL_SUCCESS);
  relationships.add(REL_FAILURE);
  this.relationships = Collections.unmodifiableSet(relationships);
}
origin: dropwizard/dropwizard

public static <T> Set<T> of(T e1, T e2) {
  final Set<T> set = new HashSet<>(2);
  set.add(e1);
  set.add(e2);
  return unmodifiableSet(set);
}
origin: spring-projects/spring-framework

/**
 * Return the ids of the managed {@link MessageListenerContainer} instance(s).
 * @since 4.2.3
 * @see #getListenerContainer(String)
 */
public Set<String> getListenerContainerIds() {
  return Collections.unmodifiableSet(this.listenerContainers.keySet());
}
origin: square/okhttp

/**
 * Returns the distinct query parameter names in this URL, like {@code ["a", "b"]} for {@code
 * http://host/?a=apple&b=banana}. If this URL has no query this returns the empty set.
 *
 * <p><table summary="">
 *   <tr><th>URL</th><th>{@code queryParameterNames()}</th></tr>
 *   <tr><td>{@code http://host/}</td><td>{@code []}</td></tr>
 *   <tr><td>{@code http://host/?}</td><td>{@code [""]}</td></tr>
 *   <tr><td>{@code http://host/?a=apple&k=key+lime}</td><td>{@code ["a", "k"]}</td></tr>
 *   <tr><td>{@code http://host/?a=apple&a=apricot}</td><td>{@code ["a"]}</td></tr>
 *   <tr><td>{@code http://host/?a=apple&b}</td><td>{@code ["a", "b"]}</td></tr>
 * </table>
 */
public Set<String> queryParameterNames() {
 if (queryNamesAndValues == null) return Collections.emptySet();
 Set<String> result = new LinkedHashSet<>();
 for (int i = 0, size = queryNamesAndValues.size(); i < size; i += 2) {
  result.add(queryNamesAndValues.get(i));
 }
 return Collections.unmodifiableSet(result);
}
origin: org.springframework/spring-context

/**
 * Update the exposed {@link #cacheNames} set with the given name.
 * <p>This will always be called within a full {@link #cacheMap} lock
 * and effectively behaves like a {@code CopyOnWriteArraySet} with
 * preserved order but exposed as an unmodifiable reference.
 * @param name the name of the cache to be added
 */
private void updateCacheNames(String name) {
  Set<String> cacheNames = new LinkedHashSet<>(this.cacheNames.size() + 1);
  cacheNames.addAll(this.cacheNames);
  cacheNames.add(name);
  this.cacheNames = Collections.unmodifiableSet(cacheNames);
}
origin: apache/shiro

public Set<String> keySet() {
  return CollectionUtils.isEmpty(this.combinedPrincipals) ?
      Collections.<String>emptySet() :
      Collections.unmodifiableSet(this.combinedPrincipals.keySet());
}
origin: apache/kafka

/**
 * Creates an instance with the specified parameters.
 *
 * @param topicPartitions List of topic partitions
 */
public MemberAssignment(Set<TopicPartition> topicPartitions) {
  this.topicPartitions = topicPartitions == null ? Collections.<TopicPartition>emptySet() :
    Collections.unmodifiableSet(new HashSet<>(topicPartitions));
}
origin: apache/nifi

@Override
protected void init(final ProcessorInitializationContext context) {
  final Set<Relationship> relationships = new HashSet<>();
  relationships.add(REL_FAILURE);
  relationships.add(REL_SUCCESS);
  this.relationships = Collections.unmodifiableSet(relationships);
  final List<PropertyDescriptor> properties = new ArrayList<>();
  properties.add(HASH_VALUE_ATTRIBUTE);
  this.properties = Collections.unmodifiableList(properties);
}
origin: dropwizard/dropwizard

public static <T> Set<T> of(T e1, T e2, T e3) {
  final Set<T> set = new HashSet<>(3);
  set.add(e1);
  set.add(e2);
  set.add(e3);
  return unmodifiableSet(set);
}
origin: google/guava

@Override
public Set<E> incidentEdges() {
 return Collections.unmodifiableSet(incidentEdgeMap.keySet());
}
java.utilCollectionsunmodifiableSet

Javadoc

Returns a wrapper on the specified set which throws an UnsupportedOperationException whenever an attempt is made to modify the set.

Popular methods of Collections

  • emptyList
    Returns the empty list (immutable). This list is serializable.This example illustrates the type-safe
  • sort
  • singletonList
    Returns an immutable list containing only the specified object. The returned list is serializable.
  • unmodifiableList
    Returns an unmodifiable view of the specified list. This method allows modules to provide users with
  • emptyMap
    Returns the empty map (immutable). This map is serializable.This example illustrates the type-safe w
  • emptySet
    Returns the empty set (immutable). This set is serializable. Unlike the like-named field, this metho
  • unmodifiableMap
    Returns an unmodifiable view of the specified map. This method allows modules to provide users with
  • singleton
    Returns an immutable set containing only the specified object. The returned set is serializable.
  • singletonMap
    Returns an immutable map, mapping only the specified key to the specified value. The returned map is
  • addAll
    Adds all of the specified elements to the specified collection. Elements to be added may be specifie
  • reverse
    Reverses the order of the elements in the specified list. This method runs in linear time.
  • unmodifiableCollection
    Returns an unmodifiable view of the specified collection. This method allows modules to provide user
  • reverse,
  • unmodifiableCollection,
  • shuffle,
  • enumeration,
  • list,
  • synchronizedMap,
  • synchronizedList,
  • reverseOrder,
  • emptyIterator

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Runner (org.openjdk.jmh.runner)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now