当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableList类代码示例

本文整理汇总了Java中com.google.common.collect.ImmutableList的典型用法代码示例。如果您正苦于以下问题:Java ImmutableList类的具体用法?Java ImmutableList怎么用?Java ImmutableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImmutableList类属于com.google.common.collect包,在下文中一共展示了ImmutableList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRecordSet

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Override
public RecordSet getRecordSet(
        ConnectorTransactionHandle transaction,
        ConnectorSession session,
        ConnectorSplit split,
        List<? extends ColumnHandle> columns
) {
    EthereumSplit ethereumSplit = convertSplit(split);

    ImmutableList.Builder<EthereumColumnHandle> handleBuilder = ImmutableList.builder();

    for (ColumnHandle handle : columns) {
        EthereumColumnHandle columnHandle = convertColumnHandle(handle);
        handleBuilder.add(columnHandle);
    }

    return new EthereumRecordSet(web3j, handleBuilder.build(), ethereumSplit);
}
 
开发者ID:xiaoyao1991,项目名称:presto-ethereum,代码行数:19,代码来源:EthereumRecordSetProvider.java

示例2: rewrite

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
/** Rewrite the parse tree as SELECT ... FROM INFORMATION_SCHEMA.SCHEMATA ... */
@Override
public SqlNode rewrite(SqlNode sqlNode) throws RelConversionException, ForemanSetupException {
  SqlShowSchemas node = unwrap(sqlNode, SqlShowSchemas.class);
  List<SqlNode> selectList =
      ImmutableList.of((SqlNode) new SqlIdentifier(SCHS_COL_SCHEMA_NAME, SqlParserPos.ZERO));

  SqlNode fromClause = new SqlIdentifier(
      ImmutableList.of(IS_SCHEMA_NAME, TAB_SCHEMATA), null, SqlParserPos.ZERO, null);

  SqlNode where = null;
  final SqlNode likePattern = node.getLikePattern();
  if (likePattern != null) {
    where = DrillParserUtil.createCondition(new SqlIdentifier(SCHS_COL_SCHEMA_NAME, SqlParserPos.ZERO),
                                            SqlStdOperatorTable.LIKE, likePattern);
  } else if (node.getWhereClause() != null) {
    where = node.getWhereClause();
  }

  return new SqlSelect(SqlParserPos.ZERO, null, new SqlNodeList(selectList, SqlParserPos.ZERO),
      fromClause, where, null, null, null, null, null, null);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:ShowSchemasHandler.java

示例3: selectDependency

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
public static Process<Event, RecipeIdentifier> selectDependency(final RecipeSource source, final PartialDependency dependency) {
    if (dependency.organization.isPresent()) {
        return Process.of(
            Single.just(RecipeIdentifier.of(dependency.source, dependency.organization.get(), dependency.project))
        );
    }
    final ImmutableList<RecipeIdentifier> candidates = Streams.stream(source
        .findCandidates(dependency))
        .limit(5)
        .collect(toImmutableList());

    if (candidates.size() == 0) {
        return Process.error(
            PartialDependencyResolutionException.of(candidates, dependency));
    }

    if (candidates.size() > 1) {
        return Process.error(PartialDependencyResolutionException.of(candidates, dependency));
    }

    return Process.of(
        Observable.just(
            Notification.of("Resolved partial dependency " + dependency.encode() + " to " + candidates.get(0).encode())),
        Single.just(candidates.get(0)));
}
 
开发者ID:LoopPerfect,项目名称:buckaroo,代码行数:26,代码来源:RecipeSources.java

示例4: expandHql

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
private static String expandHql(
    String database,
    String table,
    List<FieldSchema> dataColumns,
    List<FieldSchema> partitionColumns) {
  List<String> dataColumnNames = toQualifiedColumnNames(table, dataColumns);
  List<String> partitionColumnNames = partitionColumns != null ? toQualifiedColumnNames(table, partitionColumns)
      : ImmutableList.<String> of();
  List<String> colNames = ImmutableList
      .<String> builder()
      .addAll(dataColumnNames)
      .addAll(partitionColumnNames)
      .build();

  String cols = COMMA_JOINER.join(colNames);
  return String.format("SELECT %s FROM `%s`.`%s`", cols, database, table);
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:18,代码来源:TestUtils.java

示例5: testRemoveMultipleColumns

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
/**
 * Tests that the upgrade comes out in the right order.
 */
@Test
public void testRemoveMultipleColumns() {
  List<Class<? extends UpgradeStep>> items = ImmutableList.<Class<? extends UpgradeStep>>of(
    UpgradeStep511.class
  );

  ListBackedHumanReadableStatementConsumer consumer = new ListBackedHumanReadableStatementConsumer();
  HumanReadableStatementProducer producer = new HumanReadableStatementProducer(items);
  producer.produceFor(consumer);

  List<String> actual = consumer.getList();

  List<String> expected = ImmutableList.of(
    "VERSIONSTART:[ALFA v1.0.0]",
    "STEPSTART:[SAMPLE-7]-[UpgradeStep511]-[5.1.1 Upgrade Step]",
    "CHANGE:[Remove column abc from SomeTable]",
    "CHANGE:[Remove column def from SomeTable]",
    "STEPEND:[UpgradeStep511]",
    "VERSIONEND:[ALFA v1.0.0]"
  );

  assertEquals(expected, actual);
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:27,代码来源:TestHumanReadableStatements.java

示例6: setup

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Override
public final void setup(BufferAllocator allocator, FunctionContext context, VectorAccessible incoming, VectorAccessible outgoing,
                        List<TransferPair> transfers, ComplexWriterCreator complexWriterCollector,
                        long outputMemoryLimit, long outputBatchSize)  throws SchemaChangeException{

  this.svMode = incoming.getSchema().getSelectionVectorMode();
  switch (svMode) {
    case FOUR_BYTE:
      throw new UnsupportedOperationException("Flatten does not support selection vector inputs.");
    case TWO_BYTE:
      throw new UnsupportedOperationException("Flatten does not support selection vector inputs.");
  }
  this.transfers = ImmutableList.copyOf(transfers);
  outputAllocator = allocator;
  this.outputMemoryLimit = outputMemoryLimit;
  this.outputLimit = outputBatchSize;
  doSetup(context, incoming, outgoing, complexWriterCollector);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:19,代码来源:FlattenTemplate.java

示例7: getTypeAdapters

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
private ImmutableMap<TypeMirror, FieldSpec> getTypeAdapters(ImmutableList<Property> properties) {
    Map<TypeMirror, FieldSpec> typeAdapters = new LinkedHashMap<>();
    NameAllocator nameAllocator = new NameAllocator();
    nameAllocator.newName("CREATOR");
    for (Property property : properties) {
        if (property.typeAdapter != null && !typeAdapters.containsKey(property.typeAdapter)) {
            ClassName typeName = (ClassName) TypeName.get(property.typeAdapter);
            String name = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, typeName.simpleName());
            name = nameAllocator.newName(name, typeName);

            typeAdapters.put(property.typeAdapter, FieldSpec.builder(
                    typeName, NameAllocator.toJavaIdentifier(name), PRIVATE, STATIC, FINAL)
                    .initializer("new $T()", typeName).build());
        }
    }
    return ImmutableMap.copyOf(typeAdapters);
}
 
开发者ID:foodora,项目名称:android-auto-mapper,代码行数:18,代码来源:AutoMappperProcessor.java

示例8: testSaveItemsWithCommandAndToggleConfiguration

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void testSaveItemsWithCommandAndToggleConfiguration() throws Exception {

    when(toggleConfiguration.isMetadatasearchendpoint()).thenReturn(true);
    when(toggleConfiguration.isTtl()).thenReturn(true);

    UploadDocumentsCommand uploadDocumentsCommand = new UploadDocumentsCommand();
    uploadDocumentsCommand.setFiles(singletonList(TestUtil.TEST_FILE));
    uploadDocumentsCommand.setRoles(ImmutableList.of("a", "b"));
    uploadDocumentsCommand.setClassification(Classifications.PRIVATE);
    uploadDocumentsCommand.setMetadata(ImmutableMap.of("prop1", "value1"));
    uploadDocumentsCommand.setTtl(new Date());

    List<StoredDocument> documents = storedDocumentService.saveItems(uploadDocumentsCommand);

    final StoredDocument storedDocument = documents.get(0);
    final DocumentContentVersion latestVersion = storedDocument.getDocumentContentVersions().get(0);

    Assert.assertEquals(1, documents.size());
    Assert.assertEquals(storedDocument.getRoles(), new HashSet(ImmutableList.of("a", "b")));
    Assert.assertEquals(storedDocument.getClassification(), Classifications.PRIVATE);
    Assert.assertEquals(storedDocument.getMetadata(), ImmutableMap.of("prop1", "value1"));
    Assert.assertNotNull(storedDocument.getTtl());
    Assert.assertEquals(TestUtil.TEST_FILE.getContentType(), latestVersion.getMimeType());
    Assert.assertEquals(TestUtil.TEST_FILE.getOriginalFilename(), latestVersion.getOriginalDocumentName());
}
 
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:27,代码来源:StoredDocumentServiceTests.java

示例9: buildAndTreeShakeFromDeployJar

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
public AndroidApp buildAndTreeShakeFromDeployJar(
    CompilationMode mode, String base, boolean hasReference, int maxSize,
    Consumer<InternalOptions> optionsConsumer)
    throws ExecutionException, IOException, ProguardRuleParserException, CompilationException {
  AndroidApp app = runAndCheckVerification(
      CompilerUnderTest.R8,
      mode,
      hasReference ? base + REFERENCE_APK : null,
      null,
      base + PG_CONF,
      optionsConsumer,
      // Don't pass any inputs. The input will be read from the -injars in the Proguard
      // configuration file.
      ImmutableList.of());
  int bytes = applicationSize(app);
  assertTrue("Expected max size of " + maxSize + ", got " + bytes, bytes < maxSize);
  return app;
}
 
开发者ID:inferjay,项目名称:r8,代码行数:19,代码来源:R8GMSCoreTreeShakeJarVerificationTest.java

示例10: testRenameFollowedByAdditionUsingOldName

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
/**
 * Test:
 *   1. Rename BasicTable to BasicTableRenamed
 *   2. Add BasicTable
 *
 * This tests that everything from BasicTable has been correctly renamed.
 */
@Test
public void testRenameFollowedByAdditionUsingOldName() {
  Table newTable = table("BasicTableRenamed").columns(
    column("stringCol", DataType.STRING, 20).primaryKey(),
    column("nullableStringCol", DataType.STRING, 10).nullable(),
    column("decimalTenZeroCol", DataType.DECIMAL, 10),
    column("decimalNineFiveCol", DataType.DECIMAL, 9, 5),
    column("bigIntegerCol", DataType.BIG_INTEGER, 19),
    column("nullableBigIntegerCol", DataType.BIG_INTEGER, 19).nullable()
  );

  List<Table> tables = Lists.newArrayList(schema.tables());
  tables.add(newTable);

  verifyUpgrade(schema(tables), ImmutableList.<Class<? extends UpgradeStep>>of(RenameTable.class, AddBasicTable.class));
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:24,代码来源:TestDatabaseUpgradeIntegration.java

示例11: testInsertWithNullDefaults

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
/**
 * Test that an Insert statement is generated with a null value
 */
@Test
public void testInsertWithNullDefaults() {
  InsertStatement stmt = new InsertStatement().into(new TableReference(TEST_TABLE))
      .from(new TableReference(OTHER_TABLE)).withDefaults(
        new NullFieldLiteral().as(DATE_FIELD),
        new NullFieldLiteral().as(BOOLEAN_FIELD),
        new NullFieldLiteral().as(CHAR_FIELD),
        new NullFieldLiteral().as(BLOB_FIELD)
          );

  String expectedSql = "INSERT INTO " + tableName(TEST_TABLE) + " (id, version, stringField, intField, floatField, dateField, booleanField, charField, blobField, bigIntegerField, clobField) SELECT id, version, stringField, intField, floatField, null AS dateField, null AS booleanField, null AS charField, null AS blobField, 12345 AS bigIntegerField, null AS clobField FROM " + tableName(OTHER_TABLE);

  List<String> sql = testDialect.convertStatementToSQL(stmt, metadata, SqlDialect.IdTable.withDeterministicName("idvalues"));
  assertEquals("Insert with null defaults", ImmutableList.of(expectedSql), sql);
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:19,代码来源:AbstractSqlDialectTest.java

示例12: parseSampleTree

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void parseSampleTree() {
	PropertyTree src=FixedPropertyTree.builder()
			.put("one", FixedPropertyTree.builder()
					.put("name", "A")
					.put("children", "A-a")
					.put("children", "A-b")
					.put("children", "A-c")
					.build())
			.put("two", FixedPropertyTree.builder()
					.put("name", "B")
					.build())
			.put("3", FixedPropertyTree.builder()
					.put("name", "A-a")
					.put("children", "A-a-0")
					.build())
			.build();
	
	Tree tree = Tree.treeOf(src);
	assertEquals("Tree{relation={A=[A-a, A-b, A-c], B=[], A-a=[A-a-0]}}",tree.toString());
	
	ImmutableList<Tree.Node> mappedTree = tree.mapAsTree(ImmutableList.of("A-a-0","C","A-a","B","A"));
	assertEquals("[Node{name=C, children=[]}, Node{name=B, children=[]}, Node{name=A, children=[Node{name=A-a, children=[Node{name=A-a-0, children=[]}]}]}]", mappedTree.toString());
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:25,代码来源:TreeTest.java

示例13: testListeningDecorator

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
public void testListeningDecorator() throws Exception {
  ListeningExecutorService service =
      listeningDecorator(newDirectExecutorService());
  assertSame(service, listeningDecorator(service));
  List<Callable<String>> callables =
      ImmutableList.of(Callables.returning("x"));
  List<Future<String>> results;

  results = service.invokeAll(callables);
  assertThat(getOnlyElement(results)).isInstanceOf(TrustedListenableFutureTask.class);

  results = service.invokeAll(callables, 1, SECONDS);
  assertThat(getOnlyElement(results)).isInstanceOf(TrustedListenableFutureTask.class);

  /*
   * TODO(cpovirk): move ForwardingTestCase somewhere common, and use it to
   * test the forwarded methods
   */
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:20,代码来源:MoreExecutorsTest.java

示例14: step

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void step() throws Exception {

    Person person = Person.step()
            .id(PERSON_ID)
            .names(ImmutableList.of(PERSON_NAME, PERSON_SURNAME))
            .phones(ImmutableList.of(PERSON_PHONE))
            .homeAddress(
                    Address.step()
                            .title(ADDRESS_TITLE)
                            .street(ADDRESS_STREET)
                            .city(ADDRESS_CITY)
                            .postcode(ADDRESS_POSTCODE)
                            .countryCode(ADDRESS_COUNTRY_CODE)
                            .optional()
                            .streetParts(ADDRESS_STREET_PARTS)
                            .build()
            )
            .optional()
            .workAddress(PERSON_WORK_ADDRESS)
            .birthday(PERSON_BIRTHDAY)
            .build();

    assertPerson(person);
}
 
开发者ID:sopak,项目名称:auto-value-step-builder,代码行数:26,代码来源:SimpleTest.java

示例15: shouldGetNewStoriesOfLocation

import com.google.common.collect.ImmutableList; //导入依赖的package包/类
@Test
public void shouldGetNewStoriesOfLocation() throws Exception{
    Story story = generateStory();
    Geolocation geolocation = new Geolocation();
    geolocation.setLatitude(0);
    geolocation.setLongitude(0);
    MultiValueMap<String,String> params = new LinkedMultiValueMap<>();
    params.add("latitude",String.valueOf(geolocation.getLatitude()));
    params.add("longitude",String.valueOf(geolocation.getLongitude()));

    when(newStoriesService.getStoriesOfLocation(any(Geolocation.class))).thenReturn(ImmutableList.of(story));

    mockMvc.perform(get("/newStories/location").params(params))
            .andExpect(jsonPath("$[0].id").value(story.getId()))
            .andExpect(status().isOk());
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:17,代码来源:NewStoriesControllerTest.java


注:本文中的com.google.common.collect.ImmutableList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。