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

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

Introduction

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

Prototype

public static <E> ImmutableList<E> of(E e1, E e2, E e3, E e4) 

Source Link

Usage

From source file:cz.cuni.mff.ms.brodecva.botnicek.ide.utils.swing.components.hinters.HintingComboBox.java

/**
 * Spust testovac ukzku. Prvn box nerespektuje a druh respektuje
 * velikost psmen pi napovdn. Prvn box dle dovoluje vepsat i
 * nepovolen etzce, zatmco druh nikoli./*from w  w  w  .  j  av  a2 s  .  com*/
 * 
 * @param args
 *            argumenty
 */
public static void main(final String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                final List<String> content = ImmutableList.of("apple", "butter", "Chevrolet", "9 monkeys");

                final HintingComboBox<String> nonStrictCaseInsensitiveComboBox = HintingComboBox.create(content,
                        false, false);
                final HintingComboBox<String> strictCaseSensitiveComboBox = HintingComboBox.create(content,
                        true, true);

                final JPanel contentPane = new JPanel();
                contentPane.add(nonStrictCaseInsensitiveComboBox);
                contentPane.add(strictCaseSensitiveComboBox);

                final JFrame frame = new JFrame();
                frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                frame.setContentPane(contentPane);
                frame.pack();
                frame.setVisible(true);
            } catch (final Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:software.betamax.util.Network.java

public static Collection<String> getLocalAddresses() {
    try {// w  w w.j  a va  2s  . c  o  m
        InetAddress local = InetAddress.getLocalHost();
        return ImmutableList.of(local.getHostName(), local.getHostAddress(), "localhost", "127.0.0.1");
    } catch (UnknownHostException e) {
        throw new RuntimeException(e);
    }
}

From source file:org.sonar.batch.cpd.CpdComponents.java

public static List<Class<? extends Object>> all() {
    return ImmutableList.of(CpdSensor.class, CpdMappings.class, JavaCpdIndexer.class, DefaultCpdIndexer.class);
}

From source file:org.sonar.scanner.cpd.CpdComponents.java

public static List<Class<? extends Object>> all() {
    return ImmutableList.of(DeprecatedCpdBlockIndexerSensor.class, CpdMappings.class, JavaCpdBlockIndexer.class,
            DefaultCpdBlockIndexer.class);
}

From source file:org.sonar.plugins.spcaf.CSSSpcafProvider.java

public static List extensions() {
    return ImmutableList.of(CQSpcafRulesDefinition.class, CQSpcafSensor.class, CQSpcafProfileExporter.class,
            CQSpcafProfileImporter.class);
}

From source file:org.jetbrains.jet.plugin.versions.KotlinRuntimeLibraryCoreUtil.java

@Nullable
public static PsiClass getKotlinRuntimeMarkerClass(@NotNull GlobalSearchScope scope) {
    FqName kotlinPackageFqName = FqName.topLevel(Name.identifier("kotlin"));
    String kotlinPackageClassFqName = PackageClassUtils.getPackageClassFqName(kotlinPackageFqName).asString();

    ImmutableList<String> candidateClassNames = ImmutableList.of(kotlinPackageClassFqName, "kotlin.Unit",
            // For older versions
            "kotlin.namespace", "jet.Unit");

    for (String className : candidateClassNames) {
        PsiClass psiClass = JavaPsiFacade.getInstance(scope.getProject()).findClass(className, scope);
        if (psiClass != null) {
            return psiClass;
        }/*from w w  w . j  a v a  2s  .c o  m*/
    }
    return null;
}

From source file:org.retrostore.request.LoginRequest.java

private static List<String> getLoginPrefixWhiteList() {
    return ImmutableList.of("/gfx", "/rpc", "/api", "/public");
}

From source file:co.cask.cdap.internal.test.PluginJarHelper.java

public static Location createPluginJar(LocationFactory locationFactory, Manifest manifest, Class<?> clz,
        Class<?>... classes) throws IOException {

    ApplicationBundler bundler = new ApplicationBundler(
            ImmutableList.of("co.cask.cdap.api", "org.apache.hadoop", "org.apache.hive", "org.apache.spark"),
            ImmutableList.of("org.apache.hadoop.hbase"));
    Location jarLocation = locationFactory.create(clz.getName()).getTempFile(".jar");
    ClassLoader oldClassLoader = ClassLoaders.setContextClassLoader(clz.getClassLoader());
    try {//from   w  w w . java  2  s.  c o m
        bundler.createBundle(jarLocation, clz, classes);
    } finally {
        ClassLoaders.setContextClassLoader(oldClassLoader);
    }

    Location deployJar = locationFactory.create(clz.getName()).getTempFile(".jar");
    Manifest jarManifest = new Manifest(manifest);
    jarManifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");

    // Create the program jar for deployment. It removes the "classes/" prefix as that's the convention taken
    // by the ApplicationBundler inside Twill.
    try (JarOutputStream jarOutput = new JarOutputStream(deployJar.getOutputStream(), jarManifest);
            JarInputStream jarInput = new JarInputStream(jarLocation.getInputStream())) {
        JarEntry jarEntry = jarInput.getNextJarEntry();
        while (jarEntry != null) {
            boolean isDir = jarEntry.isDirectory();
            String entryName = jarEntry.getName();
            if (!entryName.equals("classes/")) {
                if (entryName.startsWith("classes/")) {
                    jarEntry = new JarEntry(entryName.substring("classes/".length()));
                } else {
                    jarEntry = new JarEntry(entryName);
                }

                // TODO: this is due to manifest possibly already existing in the jar, but we also
                // create a manifest programatically so it's possible to have a duplicate entry here
                if ("META-INF/MANIFEST.MF".equalsIgnoreCase(jarEntry.getName())) {
                    jarEntry = jarInput.getNextJarEntry();
                    continue;
                }

                jarOutput.putNextEntry(jarEntry);
                if (!isDir) {
                    ByteStreams.copy(jarInput, jarOutput);
                }
            }

            jarEntry = jarInput.getNextJarEntry();
        }
    }

    return deployJar;
}

From source file:co.cask.cdap.internal.test.AppJarHelper.java

public static Location createDeploymentJar(LocationFactory locationFactory, Class<?> clz, Manifest manifest,
        File... bundleEmbeddedJars) throws IOException {

    ApplicationBundler bundler = new ApplicationBundler(
            ImmutableList.of("co.cask.cdap.api", "org.apache.hadoop", "org.apache.hive", "org.apache.spark"),
            ImmutableList.of("org.apache.hadoop.hbase"));
    Location jarLocation = locationFactory.create(clz.getName()).getTempFile(".jar");
    ClassLoader oldClassLoader = ClassLoaders.setContextClassLoader(clz.getClassLoader());
    try {//  w w  w . j a  v a  2 s. co  m
        bundler.createBundle(jarLocation, clz);
    } finally {
        ClassLoaders.setContextClassLoader(oldClassLoader);
    }

    Location deployJar = locationFactory.create(clz.getName()).getTempFile(".jar");
    Manifest jarManifest = new Manifest(manifest);
    jarManifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    jarManifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, clz.getName());

    // Create the program jar for deployment. It removes the "classes/" prefix as that's the convention taken
    // by the ApplicationBundler inside Twill.
    Set<String> seenEntries = new HashSet<>();
    try (JarOutputStream jarOutput = new JarOutputStream(deployJar.getOutputStream(), jarManifest);
            JarInputStream jarInput = new JarInputStream(jarLocation.getInputStream())) {
        JarEntry jarEntry = jarInput.getNextJarEntry();
        while (jarEntry != null) {
            boolean isDir = jarEntry.isDirectory();
            String entryName = jarEntry.getName();
            if (!entryName.equals("classes/")) {
                if (entryName.startsWith("classes/")) {
                    jarEntry = new JarEntry(entryName.substring("classes/".length()));
                } else {
                    jarEntry = new JarEntry(entryName);
                }

                // TODO: this is due to manifest possibly already existing in the jar, but we also
                // create a manifest programatically so it's possible to have a duplicate entry here
                if ("META-INF/MANIFEST.MF".equalsIgnoreCase(jarEntry.getName())) {
                    jarEntry = jarInput.getNextJarEntry();
                    continue;
                }

                if (seenEntries.add(jarEntry.getName())) {
                    jarOutput.putNextEntry(jarEntry);
                    if (!isDir) {
                        ByteStreams.copy(jarInput, jarOutput);
                    }
                }
            }

            jarEntry = jarInput.getNextJarEntry();
        }

        for (File embeddedJar : bundleEmbeddedJars) {
            jarEntry = new JarEntry("lib/" + embeddedJar.getName());
            if (seenEntries.add(jarEntry.getName())) {
                jarOutput.putNextEntry(jarEntry);
                Files.copy(embeddedJar, jarOutput);
            }
        }
    }

    return deployJar;
}

From source file:org.sonar.plugins.csharp.CSharpUnitTestResultsProvider.java

public static List extensions() {
    return ImmutableList.of(CSharpUnitTestResultsAggregator.class, CSharpUnitTestResultsImportSensor.class,
            PropertyDefinition.builder(VISUAL_STUDIO_TEST_RESULTS_PROPERTY_KEY)
                    .name("Visual Studio Test Reports Paths")
                    .description("Example: \"report.trx\", \"report1.trx,report2.trx\" or \"C:/report.trx\"")
                    .category(CATEGORY).subCategory(SUBCATEGORY)
                    .onlyOnQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE).build(),
            PropertyDefinition.builder(NUNIT_TEST_RESULTS_PROPERTY_KEY).name("NUnit Test Reports Paths")
                    .description(/*from w ww  .j  a v  a 2s.  co  m*/
                            "Example: \"TestResult.xml\", \"TestResult1.xml,TestResult2.xml\" or \"C:/TestResult.xml\"")
                    .category(CATEGORY).subCategory(SUBCATEGORY)
                    .onlyOnQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE).build());
}