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


Java ImmutableList.of方法代码示例

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


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

示例1: getProviderExternalAddress

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
public static Address getProviderExternalAddress(final String pubKey, final NetworkParameters networkParameters,
		final long providerIndex) {
	
	DeterministicKey deterministicKey = DeterministicKey.deserializeB58(pubKey, networkParameters);
	DeterministicHierarchy deterministicHierarchy = new DeterministicHierarchy(deterministicKey);
	
	List<ChildNumber> child = null;
	if (deterministicKey.getDepth() == 2) {
		
		/* M/44'/0' node tpub */
		child = ImmutableList.of(new ChildNumber(0, false), new ChildNumber(0/*provider*/, false),
				new ChildNumber(/*external*/0, false), new ChildNumber((int)providerIndex, false));
	
	} else if (deterministicKey.getDepth() == 3) {
		
		/* M/44'/0'/X context tpub */
		child = ImmutableList.of(new ChildNumber(0/*provider*/, false),
				new ChildNumber(/*external*/0, false), new ChildNumber((int)providerIndex, false));
	}

	DeterministicKey imprintingKey = deterministicHierarchy.get(child, true, true);
	return imprintingKey.toAddress(networkParameters);
	
}
 
开发者ID:uniquid,项目名称:uniquid-utils,代码行数:25,代码来源:AddressUtils.java

示例2: CommentUserEventService

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Inject
public CommentUserEventService(Duniter4jClient client,
                               PluginSettings settings,
                               CryptoService cryptoService,
                               UserService userService,
                               UserEventService userEventService) {
    super("duniter.user.event.comment", client, settings, cryptoService);
    this.userService = userService;
    this.userEventService = userEventService;
    objectMapper = JacksonUtils.newObjectMapper()
            .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    this.changeListenSources = ImmutableList.of(
            new ChangeSource(MarketIndexDao.INDEX, MarketCommentDao.TYPE),
            new ChangeSource(RegistryIndexDao.INDEX, RegistryCommentDao.TYPE));
    ChangeService.registerListener(this);

    this.trace = logger.isTraceEnabled();

    this.recordType = RecordDao.TYPE;
}
 
开发者ID:duniter-gchange,项目名称:gchange-pod,代码行数:21,代码来源:CommentUserEventService.java

示例3: displayPages

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Test
public void displayPages() throws Exception {
    View pageView1 = mock(View.class, withSettings().extraInterfaces(PageView.class));
    View pageView2 = mock(View.class, withSettings().extraInterfaces(PageView.class));

    List<Page> pages = ImmutableList.of(
            new Page("page1", R.drawable.ic_share, "page1", (context, overlayCallback) -> pageView1),
            new Page("page2", R.drawable.ic_share, "page2", (context, overlayCallback) -> pageView2)
    );

    Page selectedPage = pages.get(0);

    view.displayPages(pages, selectedPage, false);

    ViewGroup iconHolder = view.findViewById(R.id.tab_icons_holder);
    assertEquals(pages.size() + 1, iconHolder.getChildCount());
    for (int i = 0; i < iconHolder.getChildCount(); i++) {
        View child = iconHolder.getChildAt(i);
        assertTrue(child.isSelected() == ObjectUtil.equals(child.getTag(), selectedPage.getId()));
    }

    ViewGroup container = view.findViewById(R.id.content);
    assertEquals(1, container.getChildCount());

    assertEquals(View.VISIBLE, view.getVisibility());
}
 
开发者ID:roshakorost,项目名称:Phial,代码行数:27,代码来源:ExpandedViewTest.java

示例4: testDataChangedWhenNotificationsAreEnabled

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Test
public void testDataChangedWhenNotificationsAreEnabled() {
    new JavaTestKit(getSystem()) {
        {
            final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
            final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
            final DOMDataTreeChangeListener mockListener = Mockito.mock(DOMDataTreeChangeListener.class);
            final Props props = DataTreeChangeListenerActor.props(mockListener, TEST_PATH);
            final ActorRef subject = getSystem().actorOf(props, "testDataTreeChangedNotificationsEnabled");

            // Let the DataChangeListener know that notifications should be
            // enabled
            subject.tell(new EnableNotification(true, "test"), getRef());

            subject.tell(new DataTreeChanged(mockCandidates), getRef());

            expectMsgClass(DataTreeChangedReply.class);

            Mockito.verify(mockListener).onDataTreeChanged(mockCandidates);
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:DataTreeChangeListenerActorTest.java

示例5: testStructWithRecursionViaNestedListElementTypes

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Test
public void testStructWithRecursionViaNestedListElementTypes()
        throws Exception
{
    ViaNestedListElementType recursiveObject = new ViaNestedListElementType();
    recursiveObject.data = "parent";
    recursiveObject.children = ImmutableList.of(new ArrayList<>());

    ViaNestedListElementType child = new ViaNestedListElementType();
    child.data = "child";
    recursiveObject.children.get(0).add(child);
    child.children = ImmutableList.of(new ArrayList<>());

    ViaNestedListElementType grandChild = new ViaNestedListElementType();
    grandChild.data = "grandchild";
    child.children.get(0).add(grandChild);

    testRoundTripSerialize(recursiveObject);
}
 
开发者ID:airlift,项目名称:drift,代码行数:20,代码来源:AbstractThriftCodecManagerTest.java

示例6: shouldThrowWhenMissingArgs

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void shouldThrowWhenMissingArgs() throws Exception {
  final CommandWithArgs commandWithArgs = new CommandWithArgs() {
    @Override
    public List<String> args() {
      return ImmutableList.of();
    }

    @Override
    public Optional<Options> options() {
      return Optional.empty();
    }

    @Override
    public List<String> asList() {
      return null;
    }
  };
  commandWithArgs.asList("foo");
}
 
开发者ID:honnix,项目名称:rkt-launcher,代码行数:21,代码来源:CommandWithArgsTest.java

示例7: run

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
public void run(NetworkParameters params) throws Exception {

        // Bring up all the objects we need, create/load a wallet, sync the chain, etc. We override WalletAppKit so we
        // can customize it by adding the extension objects - we have to do this before the wallet file is loaded so
        // the plugin that knows how to parse all the additional data is present during the load.
        appKit = new WalletAppKit(params, new File("."), "payment_channel_example_server") {
            @Override
            protected List<WalletExtension> provideWalletExtensions() {
                // The StoredPaymentChannelClientStates object is responsible for, amongst other things, broadcasting
                // the refund transaction if its lock time has expired. It also persists channels so we can resume them
                // after a restart.
                return ImmutableList.<WalletExtension>of(new StoredPaymentChannelServerStates(null));
            }
        };
        // Broadcasting can take a bit of time so we up the timeout for "real" networks
        final int timeoutSeconds = params.getId().equals(NetworkParameters.ID_REGTEST) ? 15 : 150;
        if (params == RegTestParams.get()) {
            appKit.connectToLocalHost();
        }
        appKit.startAsync();
        appKit.awaitRunning();

        System.out.println(appKit.wallet());

        // We provide a peer group, a wallet, a timeout in seconds, the amount we require to start a channel and
        // an implementation of HandlerFactory, which we just implement ourselves.
        new PaymentChannelServerListener(appKit.peerGroup(), appKit.wallet(), timeoutSeconds, Coin.valueOf(100000), this).bindAndStart(4242);
    }
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:29,代码来源:ExamplePaymentChannelServer.java

示例8: setFormatterDigits

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
/** Sets the number of fractional decimal places to be displayed on the given
 *  NumberFormat object to the value of the given integer.
 *  @return The minimum and maximum fractional places settings that the
 *          formatter had before this change, as an ImmutableList. */
private static ImmutableList<Integer> setFormatterDigits(DecimalFormat formatter, int min, int max) {
    ImmutableList<Integer> ante = ImmutableList.of(
        formatter.getMinimumFractionDigits(),
        formatter.getMaximumFractionDigits()
    );
    formatter.setMinimumFractionDigits(min);
    formatter.setMaximumFractionDigits(max);
    return ante;
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:14,代码来源:BtcFormat.java

示例9: shouldBuildCorrectList

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Test
public void shouldBuildCorrectList() {
  final GcOptions gcOptions = GcOptions.builder()
      .expirePrepared(Duration.ofHours(24))
      .gracePeriod(Duration.ofMinutes(30))
      .markOnly(true)
      .build();
  final ImmutableList<String> expected = ImmutableList.of(
      "--expire-prepared=24h0m0s",
      "--grace-period=0h30m0s",
      "--mark-only=true");
  assertEquals(expected, gcOptions.asList());
}
 
开发者ID:honnix,项目名称:rkt-launcher,代码行数:14,代码来源:GcOptionsTest.java

示例10: combineFunctions

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
/** Helper method to combine two {@link FunctionExprNode}s with a given <code>functionName</code>. If one of them is
 * null, other one is returned as it is.
 */
private static FunctionExprNode combineFunctions(final String functionName,
    final FunctionExprNode func1, final FunctionExprNode func2) {
  if (func1 == null) {
    return func2;
  }

  if (func2 == null) {
    return func1;
  }

  return new FunctionExprNode(functionName, ImmutableList.<ExprNode>of(func1, func2));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:MetadataProvider.java

示例11: registerResources_RegisterOnce_WhenAlreadyRegistered

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Test
public void registerResources_RegisterOnce_WhenAlreadyRegistered() {
  // Arrange
  final String absolutePath = "https://run.forrest.run/";
  HttpConfiguration httpConfiguration = new HttpConfiguration(ImmutableList.of(moduleA, moduleB));
  org.glassfish.jersey.server.model.Resource.Builder resourceBuilder =
      org.glassfish.jersey.server.model.Resource.builder().path(absolutePath);
  assertThat(httpConfiguration.resourceAlreadyRegistered(absolutePath), equalTo(false));

  // Act
  httpConfiguration.registerResources(resourceBuilder.build());

  // Assert
  assertThat(httpConfiguration.getResources(), hasSize(1));
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:16,代码来源:HttpConfigurationTest.java

示例12: shouldBeFalseForOnboardingDifferentTransactionEntity

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Test
public void shouldBeFalseForOnboardingDifferentTransactionEntity() {
    String transactionEntity = "transactionEntity";
    List<String>  differentTransactionEntity = ImmutableList.of("differentTransactionEntity");
    Predicate<IdentityProviderConfigEntityData> onboardingPredicate = new OnboardingForTransactionEntityPredicate(transactionEntity);

    IdentityProviderConfigEntityData onboardingDifferentTransactionEntityIdp = anIdentityProviderConfigData()
            .withOnboarding(differentTransactionEntity)
            .build();

    assertThat(onboardingPredicate.apply(onboardingDifferentTransactionEntityIdp)).isFalse();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:13,代码来源:OnboardingForTransactionEntityPredicateTest.java

示例13: visitCreateTableAsSelect

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Override
public Node visitCreateTableAsSelect(SqlBaseParser.CreateTableAsSelectContext context)
{
    Optional<String> comment = Optional.empty();
    if (context.COMMENT() != null) {
        comment = Optional.of(((StringLiteral) visit(context.string())).getValue());
    }

    Optional<List<Identifier>> columnAliases = Optional.empty();
    if (context.columnAliases() != null) {
        columnAliases = Optional.of(visit(context.columnAliases().identifier(), Identifier.class));
    }

    List<Property> properties = ImmutableList.of();
    if (context.properties() != null) {
        properties = visit(context.properties().property(), Property.class);
    }

    return new CreateTableAsSelect(
            getLocation(context),
            getQualifiedName(context.qualifiedName()),
            (Query) visit(context.query()),
            context.EXISTS() != null,
            properties,
            context.NO() == null,
            columnAliases,
            comment);
}
 
开发者ID:dbiir,项目名称:rainbow,代码行数:29,代码来源:AstBuilder.java

示例14: children

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Override
public Iterable<Path> children(Path dir) {
  if (Files.isDirectory(dir, NOFOLLOW_LINKS)) {
    try {
      return listFiles(dir);
    } catch (IOException e) {
      // the exception thrown when iterating a DirectoryStream if an I/O exception occurs
      throw new DirectoryIteratorException(e);
    }
  }
  return ImmutableList.of();
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:13,代码来源:MoreFiles.java

示例15: expectedAutoGenerateIdStatement

import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
/**
 * @see org.alfasoftware.morf.jdbc.AbstractSqlDialectTest#expectedAutoGenerateIdStatement()
 */
@Override
protected List<String> expectedAutoGenerateIdStatement() {
  return ImmutableList.of(
    "DELETE FROM idvalues where name = 'Test'",
    "INSERT INTO idvalues (name, value) VALUES('Test', (SELECT COALESCE(MAX(id) + 1, 1)  AS CurrentValue FROM Test))",
    "INSERT INTO Test (version, stringField, id) SELECT version, stringField, (SELECT COALESCE(value, 0)  FROM idvalues WHERE (name = 'Test')) + Other.id FROM Other"
  );
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:12,代码来源:TestMySqlDialect.java


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