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

@SuppressWarnings("unchecked")
    public static <E> ImmutableSet<E> of(E e1, E e2) 

Source Link

Usage

From source file:org.apache.whirr.service.ComputeServiceBuilder.java

public static ComputeService build(ServiceSpec spec) throws IOException {
    Set<AbstractModule> wiring = ImmutableSet.of(new JschSshClientModule(), new Log4JLoggingModule());

    ComputeServiceContext context = new ComputeServiceContextFactory().createContext(spec.getProvider(),
            spec.getAccount(), spec.getKey(), wiring);

    return context.getComputeService();
}

From source file:google.registry.groups.DirectoryModule.java

@Provides
static Directory provideDirectory(@Named("delegatedAdmin") GoogleCredential credential,
        @Config("projectId") String projectId) {
    return new Directory.Builder(credential.getTransport(), credential.getJsonFactory(),
            credential.createScoped(ImmutableSet.of(DirectoryScopes.ADMIN_DIRECTORY_GROUP_MEMBER,
                    DirectoryScopes.ADMIN_DIRECTORY_GROUP))).setApplicationName(projectId).build();
}

From source file:producerstest.MultibindingProducerModule.java

@Produces(type = SET_VALUES)
static ListenableFuture<Set<String>> futureStrs() {
    return Futures.<Set<String>>immediateFuture(ImmutableSet.of("foo1", "foo2"));
}

From source file:producerstest.multibindings.MultibindingModule.java

@Provides
@ElementsIntoSet
static Set<String> providedStrs() {
    return ImmutableSet.of("providedStr1", "providedStr2");
}

From source file:com.zanclus.example.jaxrs.WeldApplication.java

@Override
public Set<Class<?>> getClasses() {
    return ImmutableSet.of(GetServerTime.class, Application.class);
}

From source file:org.apache.druid.segment.writeout.SegmentWriteOutMediumFactory.java

static Set<SegmentWriteOutMediumFactory> builtInFactories() {
    return ImmutableSet.of(TmpFileSegmentWriteOutMediumFactory.instance(),
            OffHeapMemorySegmentWriteOutMediumFactory.instance());
}

From source file:se.kth.csc.payload.api.Snapshotters.java

private static ImmutableSet<String> getRoles(Account account) {
    if (account.isAdmin()) {
        return ImmutableSet.of(Role.ADMIN.getAuthority(), Role.USER.getAuthority());
    } else {/* w w  w  . ja  va2  s .  co m*/
        return ImmutableSet.of(Role.USER.getAuthority());
    }
}

From source file:producerstest.MultibindingProducerModule.java

@Produces(type = SET_VALUES)
static Set<String> strs() {
    return ImmutableSet.of("bar1", "bar2");
}

From source file:com.github.jsdossier.Paths.java

/**
 * Computes the relative path {@code from} one path {@code to} another. The
 * origin path is assumed to be a file.//from   w w  w  .  j  a  v a 2  s  . c o  m
 */
static Path getRelativePath(Path from, Path to) {
    from = from.toAbsolutePath().getParent();
    to = to.toAbsolutePath();

    Path root = getCommonPrefix(from.getRoot(), ImmutableSet.of(from, to));
    Path pathToRoot = from.relativize(root);
    Path pathFromRoot = root.relativize(to);

    return pathToRoot.resolve(pathFromRoot).normalize();
}

From source file:com.spotify.folsom.KetamaRunner.java

private static void checkKeyOkOrNotFound(final ListenableFuture<?> future) throws Throwable {
    checkStatus(future, ImmutableSet.of(MemcacheStatus.KEY_NOT_FOUND, MemcacheStatus.OK));
}