本文整理汇总了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);
}
示例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;
}
示例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());
}
示例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);
}
};
}
示例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);
}
示例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");
}
示例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);
}
示例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;
}
示例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());
}
示例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));
}
示例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));
}
示例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();
}
示例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);
}
示例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();
}
示例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"
);
}