Java Collections.unmodifiableSet Examples

Java Collections.unmodifiableSet - 30 examples found. These are the top rated real world Java examples of java.util.Collections.unmodifiableSet extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 protected Selection() {
   listeners = new ArrayList<>();
   selected = new HashSet<>();
   suppressed = new HashMap<>();
   selectedView = Collections.unmodifiableSet(selected);
   suppressedView = Collections.unmodifiableSet(suppressed.keySet());
 }
Example #2
0
  static {
    ResourceBundle rb =
        ResourceBundle.getBundle(
            "calendar/" + ISO_CALENDAR_TYPE,
            Locale.ROOT,
            getDefaultLoader(),
            UTF8ResourceControl.SINGLETON);

    String[] languages = rb.getString("languages").split(" ");
    Set<String> tmp = new HashSet<>();
    Collections.addAll(tmp, languages);
    LANGUAGES = Collections.unmodifiableSet(tmp);

    Set<Locale> locs = new HashSet<>();

    for (String lang : LANGUAGES) {
      locs.add(new Locale(lang));
    }

    // defensive strategy in case JDK should change its behaviour
    for (LanguageMatch lm : LanguageMatch.values()) {
      locs.add(new Locale(lm.name())); // in Java 8 or earlier no effect
    }

    LOCALES = Collections.unmodifiableSet(locs);
  }
  public TestListResolver(Collection<String> tests) {
    final IncludedExcludedPatterns patterns = new IncludedExcludedPatterns();
    final Set<ResolvedTest> includedFilters = new LinkedHashSet<ResolvedTest>(0);
    final Set<ResolvedTest> excludedFilters = new LinkedHashSet<ResolvedTest>(0);
    final Set<String> specificClasses = new LinkedHashSet<String>(0);

    for (final String csvTests : tests) {
      if (StringUtils.isNotBlank(csvTests)) {
        for (String request : StringUtils.split(csvTests, ",")) {
          request = request.trim();
          if (request.length() != 0 && !request.equals("!")) {
            resolveTestRequest(request, patterns, includedFilters, excludedFilters);
          }
        }
      }
    }

    for (ResolvedTest test : includedFilters) {
      populateSpecificClasses(specificClasses, test);
    }

    for (ResolvedTest test : excludedFilters) {
      populateSpecificClasses(specificClasses, test);
    }

    this.specificClasses = Collections.unmodifiableSet(specificClasses);
    this.includedPatterns = Collections.unmodifiableSet(includedFilters);
    this.excludedPatterns = Collections.unmodifiableSet(excludedFilters);
    this.hasIncludedMethodPatterns = patterns.hasIncludedMethodPatterns;
    this.hasExcludedMethodPatterns = patterns.hasExcludedMethodPatterns;
  }
  static {
    Set<Class<?>> customAnnotations = new HashSet<Class<?>>();
    customAnnotations.add(SetterCustomStringValue1.class);
    customAnnotations.add(SetterCustomStringValue2.class);
    customAnnotations.add(SetterCustomStringValue3.class);
    customAnnotations.add(SetterCustomStringValue4.class);
    customAnnotations.add(SetterCustomStringValue5.class);
    customAnnotations.add(SetterCustomNumberValue1.class);
    customAnnotations.add(SetterCustomNumberValue2.class);
    customAnnotations.add(SetterCustomNumberValue3.class);
    customAnnotations.add(SetterCustomNumberValue4.class);
    customAnnotations.add(SetterCustomNumberValue5.class);
    customAnnotations.add(SetterCustomDateValue1.class);
    customAnnotations.add(SetterCustomDateValue2.class);
    customAnnotations.add(SetterCustomDateValue3.class);
    CUSTOM_ANNOTATIONS = Collections.unmodifiableSet(customAnnotations);

    Set<Class<?>> mappingAnnotations = new HashSet<Class<?>>();
    mappingAnnotations.add(SetterPublisher.class);
    mappingAnnotations.add(SetterIncomingTime.class);
    mappingAnnotations.add(SetterOutcomingTime.class);
    mappingAnnotations.add(SetterInputName.class);
    mappingAnnotations.add(SetterUrl.class);
    mappingAnnotations.add(SetterRequest.class);
    mappingAnnotations.add(SetterResponse.class);
    mappingAnnotations.add(SetterServiceName.class);
    mappingAnnotations.add(UseLoggingInfoConvertor.class);

    MAPPING_ANNOTATIONS = Collections.unmodifiableSet(mappingAnnotations);
  }
Example #5
0
 static {
   Set<String> set = new HashSet<String>();
   set.add("add");
   set.add("sub");
   set.add("and");
   set.add("or");
   twoArgArithmeticCommandSet = Collections.unmodifiableSet(set);
   set = new HashSet<String>();
   set.add("neg");
   set.add("not");
   singleArgArithmeticCommandSet = Collections.unmodifiableSet(set);
   set = new HashSet<String>();
   set.add("gt");
   set.add("lt");
   set.add("eq");
   twoArgArithmeticComparisonCommandSet = Collections.unmodifiableSet(set);
   Map<String, String> map = new HashMap<String, String>();
   map.put("add", "+");
   map.put("sub", "-");
   map.put("and", "&");
   map.put("or", "|");
   map.put("neg", "-");
   map.put("not", "!");
   map.put("gt", "JGT");
   map.put("lt", "JLT");
   map.put("eq", "JEQ");
   arithmeticOperatorMap = Collections.unmodifiableMap(map);
 }
Example #6
0
  protected AbstractTypedFilter(
      final Collection<RelationshipType> types,
      final Collection<RelationshipType> descendantTypes,
      final boolean includeManagedInfo,
      final boolean includeConcreteInfo) {
    if (types == null || types.isEmpty()) {
      this.types =
          Collections.unmodifiableSet(
              new HashSet<RelationshipType>(Arrays.asList(RelationshipType.values())));
    } else {
      this.types = Collections.unmodifiableSet(new HashSet<RelationshipType>(types));
    }

    if (descendantTypes == null || descendantTypes.isEmpty()) {
      this.descendantTypes =
          Collections.unmodifiableSet(
              new HashSet<RelationshipType>(Arrays.asList(RelationshipType.values())));
    } else {
      this.descendantTypes =
          Collections.unmodifiableSet(new HashSet<RelationshipType>(descendantTypes));
    }

    this.includeManagedInfo = includeManagedInfo;
    this.includeConcreteInfo = includeConcreteInfo;
  }