Java Code Examples for com.google.common.collect.Sets#newEnumSet()

The following examples show how to use com.google.common.collect.Sets#newEnumSet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SortingTopNProjector.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public Set<Requirement> requirements() {
    if (requirements == null) {
        requirements = Sets.newEnumSet(downstream.requirements(), Requirement.class);
        requirements.remove(Requirement.REPEAT);
    }
    return requirements;
}
 
Example 2
Source File: GroupingProjector.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public Set<Requirement> requirements() {
    if (requirements == null) {
        requirements = Sets.newEnumSet(downstream.requirements(), Requirement.class);
        requirements.remove(Requirement.REPEAT);
    }
    return requirements;
}
 
Example 3
Source File: NaBL2ConfigReaderWriter.java    From spoofax with Apache License 2.0 5 votes vote down vote up
private static Collection<Flag> readFlags(String flagNames) {
    List<Flag> flags = Lists.newArrayList();
    for(String name : splitString(flagNames)) {
        try {
            flags.add(Flag.valueOf(name.toUpperCase()));
        } catch(IllegalArgumentException ex) {
        }
    }
    return Sets.newEnumSet(flags, Flag.class);
}
 
Example 4
Source File: NameStyle.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
public NameStyle(Iterable<NameFlag> flags) {
    this(Sets.newEnumSet(flags, NameFlag.class));
}
 
Example 5
Source File: Requirements.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public static Set<Requirement> add(Set<Requirement> requirements, Requirement additionalRequirement) {
    EnumSet<Requirement> newRequirements = Sets.newEnumSet(requirements, Requirement.class);
    newRequirements.add(additionalRequirement);
    return Collections.unmodifiableSet(newRequirements);
}
 
Example 6
Source File: Requirements.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public static Set<Requirement> remove(Set<Requirement> requirements, Requirement requirementToRemove) {
    EnumSet<Requirement> newRequirements = Sets.newEnumSet(requirements, Requirement.class);
    newRequirements.remove(requirementToRemove);
    return Collections.unmodifiableSet(newRequirements);
}