Example usage for com.google.common.collect Lists asList

List of usage examples for com.google.common.collect Lists asList

Introduction

In this page you can find the example usage for com.google.common.collect Lists asList.

Prototype

public static <E> List<E> asList(@Nullable E first, E[] rest) 

Source Link

Document

Returns an unmodifiable list containing the specified first element and backed by the specified array of additional elements.

Usage

From source file:org.apache.hadoop.hbase.security.visibility.DefaultVisibilityLabelServiceImpl.java

protected List<String> getSystemAndSuperUsers() throws IOException {
    User user = User.getCurrent();/*from  w w w . j  a  v a2s.c o  m*/
    if (user == null) {
        throw new IOException("Unable to obtain the current user, "
                + "authorization checks for internal operations will not work correctly!");
    }
    if (LOG.isTraceEnabled()) {
        LOG.trace("Current user name is " + user.getShortName());
    }
    String currentUser = user.getShortName();
    List<String> superUsers = Lists.asList(currentUser,
            this.conf.getStrings(AccessControlLists.SUPERUSER_CONF_KEY, new String[0]));
    return superUsers;
}

From source file:com.google.gplus.serializer.util.GooglePlusActivityUtil.java

/**
 * Formats the ID to conform with the Apache Streams activity ID convention
 * @param idparts the parts of the ID to join
 * @return a valid Activity ID in format "id:googleplus:part1:part2:...partN"
 *//*ww w . j  ava  2 s.c  om*/
public static String formatId(String... idparts) {
    return Joiner.on(":").join(Lists.asList("id:googleplus", idparts));
}

From source file:brooklyn.test.HttpTestUtils.java

public static void assertErrorContentNotContainsText(final String url, final String phrase,
        final String... additionalPhrases) {
    try {//from  ww w.j  a va 2 s  .  c  o m
        String err = getErrorContent(url);
        Assert.assertTrue(err != null);
        for (String text : Lists.asList(phrase, additionalPhrases)) {
            if (err.contains(text)) {
                LOG.warn("CONTENTS OF URL " + url + " HAS TEXT: " + text + "\n" + err);
                Assert.fail("URL " + url + " contain text: " + text);
            }
        }
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

From source file:org.sonar.sslr.grammar.GrammarBuilder.java

/**
 * Creates parsing expression - "next not".
 * Convenience method equivalent to calling {@code nextNot(sequence(e1, rest))}.
 *
 * @param e1  sub-expression/*from w  w w. j a  v  a 2 s . c om*/
 * @param rest  rest of sub-expressions
 * @throws IllegalArgumentException if any of given arguments is not a parsing expression
 * @see #nextNot(Object)
 * @see #sequence(Object, Object)
 */
public final Object nextNot(Object e1, Object... rest) {
    return new NextNotExpression(new SequenceExpression(convertToExpressions(Lists.asList(e1, rest))));
}

From source file:org.eclipse.che.ide.ext.github.client.importer.page.GithubImporterPagePresenter.java

/**
 * Authorizes on GitHub./* ww w.j  a  v a  2  s . c o m*/
 */
private void authorize() {
    showProcessing(true);
    gitHubAuthenticator.authenticate(
            OAuth2AuthenticatorUrlProvider.get(restContext, "github",
                    appContext.getCurrentUser().getProfile().getUserId(),
                    Lists.asList("user", new String[] { "repo", "write:public_key" })),
            new AsyncCallback<OAuthStatus>() {
                @Override
                public void onFailure(Throwable caught) {
                    showProcessing(false);
                }

                @Override
                public void onSuccess(OAuthStatus result) {
                    showProcessing(false);
                    getUserRepositoriesAndOrganizations();
                }
            });
}

From source file:org.apache.streams.twitter.serializer.util.TwitterActivityUtil.java

/**
 * Formats the ID to conform with the Apache Streams activity ID convention
 * @param idparts the parts of the ID to join
 * @return a valid Activity ID in format "id:twitter:part1:part2:...partN"
 *///from   w  w  w.  j av  a  2s .  com
public static String formatId(String... idparts) {
    return Joiner.on(":").join(Lists.asList("id:twitter", idparts));
}

From source file:org.adsync4j.testutils.ldap.EmbeddedUnboundIDLdapServer.java

public EmbeddedUnboundIDLdapServer setRootDNs(String firstRootDN, String... restRootDNs) {
    assertUninitialized();/*  ww w .  ja  va  2 s  . c o m*/
    requireNonNull(firstRootDN);
    requireNonNull(restRootDNs);
    _rootDNs = Lists.newArrayList(Lists.asList(firstRootDN, restRootDNs));
    return this;
}

From source file:org.onosproject.store.consistent.impl.DatabaseManager.java

@Override
public List<PartitionInfo> getPartitionInfo() {
    return Lists.asList(inMemoryDatabase, partitionedDatabase.getPartitions().toArray(new Database[] {}))
            .stream().map(DatabaseManager::toPartitionInfo).collect(Collectors.toList());
}

From source file:org.eclipse.che.plugin.github.ide.importer.page.GithubImporterPagePresenter.java

/**
 * Authorizes on GitHub.// w w  w.j  a v a2 s  . c om
 */
private void authorize() {
    showProcessing(true);
    gitHubAuthenticator.authenticate(
            OAuth2AuthenticatorUrlProvider.get(baseUrl, "github",
                    appContext.getCurrentUser().getProfile().getUserId(),
                    Lists.asList("user", new String[] { "repo", "write:public_key" })),
            new AsyncCallback<OAuthStatus>() {
                @Override
                public void onFailure(Throwable caught) {
                    showProcessing(false);
                }

                @Override
                public void onSuccess(OAuthStatus result) {
                    showProcessing(false);
                    getUserRepositoriesAndOrganizations();
                }
            });
}

From source file:org.apache.streams.instagram.serializer.util.InstagramActivityUtil.java

/**
 * Formats the ID to conform with the Apache Streams activity ID convention
 * @param idparts the parts of the ID to join
 * @return a valid Activity ID in format "id:instagram:part1:part2:...partN"
 *//*  ww w .  jav  a 2s.co  m*/
public static String formatId(String... idparts) {
    return Joiner.on(":").join(Lists.asList("id:instagram", idparts));
}