Example usage for com.google.common.collect ImmutableSet of

List of usage examples for com.google.common.collect ImmutableSet of

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSet of.

Prototype

public static <E> ImmutableSet<E> of(E element) 

Source Link

Usage

From source file:org.apache.carbondata.hive.CarbonStorageFormatDescriptor.java

@Override
public Set<String> getNames() {
    return ImmutableSet.of("CARBONDATA");
}

From source file:com.spotify.heroic.common.Groups.java

public static Groups of(final String group) {
    return new Groups(ImmutableSet.of(group));
}

From source file:com.mysema.query.util.CollectionUtils.java

public static <T> Set<T> add(Set<T> set, T element) {
    final int size = set.size();
    if (size == 0) {
        return ImmutableSet.of(element);
    } else if (set instanceof ImmutableSet) {
        if (size == 1) {
            final T val = set.iterator().next();
            set = Sets.newHashSet();/*from  www. j  ava2 s  .  c o  m*/
            set.add(val);
        } else {
            set = Sets.newHashSet(set);
        }
    }
    set.add(element);
    return set;
}

From source file:org.nmdp.ngs.hml.rules.HmlValidationRules.java

/**
 * Return the set of HML validation rules that implement the MIRING specification.
 *
 * @return the set of HML validation rules that implement the MIRING specification
 *//*from  w w  w . ja  v a2s. c  o  m*/
public static Set<HmlValidationRule> miringRules() {
    return ImmutableSet.of(HMLID_ELEMENT_REQUIRED);
}

From source file:io.mindmaps.graql.internal.query.predicate.ComparatorPredicate.java

/**
 * @param value the value that this predicate is testing against
 *///w  ww.j  a va2  s  .c  o m
public ComparatorPredicate(Object value) {
    super(ImmutableSet.of(value));
    this.value = value;
}

From source file:tile80.behaviors80.Activator.java

@Override
public Iterable<Tile80> crunch(Tile80 self, World80 world, Set<String> event) {
    if (event.contains("activate"))
        return ImmutableSet.of(self.addTag("activate"));
    return ImmutableSet.of(self.removeTag("activate"));
}

From source file:org.graylog.collector.file.naming.ExactFileStrategy.java

public ExactFileStrategy(Path basePath) {
    this(ImmutableSet.of(basePath));
}

From source file:org.graylog2.shared.system.stats.fs.JmxFsProbe.java

@Inject
public JmxFsProbe(@Named("message_journal_dir") File journalDirectory) {
    this.locations = ImmutableSet.of(journalDirectory);
}

From source file:org.waveprotocol.wave.crypto.FakeTrustRootsProvider.java

public FakeTrustRootsProvider(X509Certificate cert) {
    this.certs = ImmutableSet.of(cert);
}

From source file:org.mitre.oauth2.web.AuthenticationUtilities.java

/**
 * Makes sure the authentication contains the given scope, throws an exception otherwise
 * @param auth the authentication object to check
 * @param scope the scope to look for//from  www  .ja v  a2 s. c  o  m
 * @throws InsufficientScopeException if the authentication does not contain that scope
 */
public static void ensureOAuthScope(Authentication auth, String scope) {
    // if auth is OAuth, make sure we've got the right scope
    if (auth instanceof OAuth2Authentication) {
        OAuth2Authentication oAuth2Authentication = (OAuth2Authentication) auth;
        if (oAuth2Authentication.getOAuth2Request().getScope() == null
                || !oAuth2Authentication.getOAuth2Request().getScope().contains(scope)) {
            throw new InsufficientScopeException("Insufficient scope", ImmutableSet.of(scope));
        }
    }
}