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

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

Introduction

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

Prototype

public static <K, V> ImmutableMap<K, V> of() 

Source Link

Usage

From source file:tile80.tile80.Tile80.java

public static Tile80 newEmpty(String id) {
    Set lst = ImmutableSet.of();/*  www . j  a v  a2 s .  co  m*/
    Map map = ImmutableMap.of();
    return new Tile80Eager(new Pair(0, 0), id, lst, lst, map);
}

From source file:io.prestosql.verifier.QueryPairMapper.java

@Override
public QueryPair map(ResultSet resultSet, StatementContext context) throws SQLException {
    Map<String, String> sessionProperties = ImmutableMap.of();
    String json = resultSet.getString("session_properties_json");
    if (json != null) {
        sessionProperties = propertiesJsonCodec.fromJson(json);
    }//from  w  w  w  . ja v a2  s  .  c om

    return new QueryPair(resultSet.getString("suite"), resultSet.getString("name"),
            new Query(resultSet.getString("test_catalog"), resultSet.getString("test_schema"),
                    fromJsonString(resultSet.getString("test_prequeries")), resultSet.getString("test_query"),
                    fromJsonString(resultSet.getString("test_postqueries")),
                    resultSet.getString("test_username"), resultSet.getString("test_password"),
                    sessionProperties),
            new Query(resultSet.getString("control_catalog"), resultSet.getString("control_schema"),
                    fromJsonString(resultSet.getString("control_prequeries")),
                    resultSet.getString("control_query"),
                    fromJsonString(resultSet.getString("control_postqueries")),
                    resultSet.getString("control_username"), resultSet.getString("control_password"),
                    sessionProperties));
}

From source file:org.openqa.selenium.tools.PackageParser.java

private static Map<String, Path> processSingleSourceFile(Path source) {
    if (!source.getFileName().toString().endsWith(".java")) {
        return ImmutableMap.of();
    }//from   w w  w  .  j  av  a2s  .c  o  m
    try {
        CompilationUnit unit = JavaParser.parse(source);
        String packageName = unit.getPackageDeclaration().map(decl -> decl.getName().asString()).orElse("");
        Path target = Paths.get(packageName.replace('.', File.separatorChar)).resolve(source.getFileName());
        return ImmutableMap.of(target.toString(), source);
    } catch (ParseProblemException | IOException ignored) {
        return ImmutableMap.of();
    }
}

From source file:org.codice.alliance.security.banner.marking.SciControl.java

public SciControl(String marking) {
    String[] split = marking.split("[-]");
    control = split[0];//from  w w  w . j  a va  2  s.  c  o  m

    if (split.length == 1) {
        compartments = ImmutableMap.of();
        return;
    }

    Map<String, List<String>> tempCompartments = new HashMap<>();
    for (int i = 1; i < split.length; i++) {
        String[] compartment = split[i].split(" ");
        List<String> subComps;
        if (compartment.length > 1) {
            subComps = ImmutableList
                    .copyOf(Arrays.asList(Arrays.copyOfRange(compartment, 1, compartment.length)));
        } else {
            subComps = ImmutableList.of();
        }
        tempCompartments.put(compartment[0], subComps);
    }

    compartments = ImmutableSortedMap.copyOf(tempCompartments);
}

From source file:com.spotify.heroic.metric.bigtable.api.Table.java

public Table(final String cluster, final String name) {
    this(cluster, name, ImmutableMap.of());
}

From source file:io.prestosql.plugin.hive.HiveBenchmarkQueryRunner.java

public static LocalQueryRunner createLocalQueryRunner(File tempDir) {
    Session session = testSessionBuilder().setCatalog("hive").setSchema("tpch").build();

    LocalQueryRunner localQueryRunner = new LocalQueryRunner(session);

    // add tpch/*from  w  ww .  j a  v a  2  s.  c  o  m*/
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());

    // add hive
    File hiveDir = new File(tempDir, "hive_data");
    ExtendedHiveMetastore metastore = createTestingFileHiveMetastore(hiveDir);
    metastore.createDatabase(Database.builder().setDatabaseName("tpch").setOwnerName("public")
            .setOwnerType(PrincipalType.ROLE).build());

    HiveConnectorFactory hiveConnectorFactory = new HiveConnectorFactory("hive",
            HiveBenchmarkQueryRunner.class.getClassLoader(), Optional.of(metastore));

    Map<String, String> hiveCatalogConfig = ImmutableMap.<String, String>builder()
            .put("hive.max-split-size", "10GB").build();

    localQueryRunner.createCatalog("hive", hiveConnectorFactory, hiveCatalogConfig);

    localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch.sf1.orders");
    localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch.sf1.lineitem");
    return localQueryRunner;
}

From source file:com.facebook.swift.service.puma.swift.SingleQueryInfo.java

@ThriftConstructor
public SingleQueryInfo(String logicalTableName, Map<String, String> filter, List<String> selectList) {
    this.logicalTableName = logicalTableName;
    if (filter != null) {
        this.filter = ImmutableMap.copyOf(filter);
    } else {/*from  w  w w.  java 2s  .  c  o m*/
        this.filter = ImmutableMap.of();
    }
    if (selectList != null) {
        this.selectList = ImmutableList.copyOf(selectList);
    } else {
        this.selectList = ImmutableList.of();
    }
}

From source file:com.facebook.presto.verifier.QueryPairMapper.java

@Override
public QueryPair map(int index, ResultSet resultSet, StatementContext statementContext) throws SQLException {
    Map<String, String> sessionProperties = ImmutableMap.of();
    String json = resultSet.getString("session_properties_json");
    if (json != null) {
        sessionProperties = propertiesJsonCodec.fromJson(json);
    }// ww w. j  a v  a2 s  .  com

    return new QueryPair(resultSet.getString("suite"), resultSet.getString("name"),
            new Query(resultSet.getString("test_catalog"), resultSet.getString("test_schema"),
                    fromJsonString(resultSet.getString("test_prequeries")), resultSet.getString("test_query"),
                    fromJsonString(resultSet.getString("test_postqueries")),
                    resultSet.getString("test_username"), resultSet.getString("test_password"),
                    sessionProperties),
            new Query(resultSet.getString("control_catalog"), resultSet.getString("control_schema"),
                    fromJsonString(resultSet.getString("control_prequeries")),
                    resultSet.getString("control_query"),
                    fromJsonString(resultSet.getString("control_postqueries")),
                    resultSet.getString("control_username"), resultSet.getString("control_password"),
                    sessionProperties));
}

From source file:com.facebook.swift.service.puma.swift.ReadResultQueryInfoTimeString.java

@ThriftConstructor
public ReadResultQueryInfoTimeString(String startTimeResultWindow, Map<String, String> columnNameValueMap) {
    this.startTimeResultWindow = startTimeResultWindow;
    if (columnNameValueMap != null) {
        this.columnNameValueMap = ImmutableMap.copyOf(columnNameValueMap);
    } else {/*  w  w w  .  j ava2 s.c o  m*/
        this.columnNameValueMap = ImmutableMap.of();
    }
}

From source file:com.facebook.buck.android.AndroidInstrumentationApkBuilder.java

private AndroidInstrumentationApkBuilder(BuildTarget target) {
    super(new AndroidInstrumentationApkDescription(new ProGuardConfig(FakeBuckConfig.builder().build()),
            ANDROID_JAVAC_OPTIONS, ImmutableMap.of(), MoreExecutors.newDirectExecutorService(),
            new CxxBuckConfig(new FakeBuckConfig.Builder().build())), target);
}