Example usage for com.google.common.collect Sets immutableEnumSet

List of usage examples for com.google.common.collect Sets immutableEnumSet

Introduction

In this page you can find the example usage for com.google.common.collect Sets immutableEnumSet.

Prototype


@GwtCompatible(serializable = true)
public static <E extends Enum<E>> ImmutableSet<E> immutableEnumSet(Iterable<E> elements) 

Source Link

Document

Returns an immutable set instance containing the given enum elements.

Usage

From source file:com.stratio.morphlines.refererparser.Medium.java

public static boolean contains(String value) {
    final ImmutableSet<Medium> set = Sets.immutableEnumSet(Arrays.asList(Medium.values()));
    return set.contains(Medium.fromString(value));
}

From source file:org.immutables.generator.Compiler.java

private static ImmutableSet<Compiler> detectCompilers() {
    EnumSet<Compiler> compilers = EnumSet.noneOf(Compiler.class);
    try {/*  ww w .ja va 2s. c om*/
        // Specific method is not essential, we just
        // forcing to load class here
        ClassSymbol.class.getCanonicalName();
        compilers.add(Compiler.JAVAC);
    } catch (Throwable ex) {
    }
    try {
        // just forcing the loading of class
        ElementImpl.class.getCanonicalName();
        compilers.add(Compiler.ECJ);
    } catch (Throwable ex) {
    }
    return Sets.immutableEnumSet(compilers);
}

From source file:com.google.doubleclick.openrtb.MapperUtil.java

@SuppressWarnings("unchecked")
public static <E extends Enum<E>> ImmutableSet<E>[] multimapIntToEnumSets(ImmutableMultimap<Integer, E> mmap) {
    int iMax = Collections.max(mmap.keySet());
    ImmutableSet<E>[] setArray = new ImmutableSet[iMax + 1];
    for (Integer key : mmap.keySet()) {
        setArray[key] = Sets.immutableEnumSet(mmap.get(key));
    }/*from  w w w.  ja v a2  s  .  com*/
    return setArray;
}

From source file:com.kotcrab.vis.editor.event.ResourceReloadedEvent.java

public ResourceReloadedEvent(Set<ResourceType> resourceTypes) {
    this.resourceTypes = Sets.immutableEnumSet(resourceTypes);
}

From source file:com.google.gapid.image.Histogram.java

private static Set<Stream.Channel> getChannels(Image[] images) {
    return Sets.immutableEnumSet(stream(images).flatMap(i -> i.getChannels().stream()).collect(toSet()));
}

From source file:io.airlift.drift.codec.internal.compiler.byteCode.FieldDefinition.java

public FieldDefinition(EnumSet<Access> access, String name, ParameterizedType type) {
    this.access = Sets.immutableEnumSet(access);
    this.name = name;
    this.type = type;
}

From source file:org.trnltk.morphology.contextless.parser.SuffixFormGraphNodeKey.java

public SuffixFormGraphNodeKey(SuffixGraphState state, Set<PhoneticAttribute> phonAttrSet) {
    this.state = state;
    this.phonAttrSet = Sets.immutableEnumSet(phonAttrSet);
}

From source file:com.google.javascript.jscomp.fuzzing.StringFuzzer.java

@Override
protected Set<Type> supportedTypes() {
    return Sets.immutableEnumSet(Type.STRING);
}

From source file:com.facebook.presto.byteCode.FieldDefinition.java

public FieldDefinition(ClassDefinition declaringClass, EnumSet<Access> access, String name,
        ParameterizedType type) {
    this.declaringClass = declaringClass;
    this.access = Sets.immutableEnumSet(access);
    this.name = name;
    this.type = type;
}

From source file:com.google.javascript.jscomp.fuzzing.NumericFuzzer.java

@Override
protected Set<Type> supportedTypes() {
    return Sets.immutableEnumSet(Type.NUMBER);
}