java.util.Collections#singletonList ( )源码实例Demo

下面列出了java.util.Collections#singletonList ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: phoenix   文件: PhoenixStatement.java
@SuppressWarnings("unchecked")
@Override
public MutationPlan compilePlan(final PhoenixStatement stmt, Sequence.ValueOp seqAction) throws SQLException {
    final StatementContext context = new StatementContext(stmt);
    return new BaseMutationPlan(context, this.getOperation()) {
        @Override
        public ExplainPlan getExplainPlan() throws SQLException {
            return new ExplainPlan(Collections.singletonList("ALTER INDEX"));
        }

        @Override
        public MutationState execute() throws SQLException {
            MetaDataClient client = new MetaDataClient(getContext().getConnection());
            return client.alterIndex(ExecutableAlterIndexStatement.this);
        }
    };
}
 
源代码2 项目: TelePlus-Android   文件: TsExtractor.java
/**
 * @param mode Mode for the extractor. One of {@link #MODE_MULTI_PMT}, {@link #MODE_SINGLE_PMT}
 *     and {@link #MODE_HLS}.
 * @param timestampAdjuster A timestamp adjuster for offsetting and scaling sample timestamps.
 * @param payloadReaderFactory Factory for injecting a custom set of payload readers.
 */
public TsExtractor(
    @Mode int mode,
    TimestampAdjuster timestampAdjuster,
    TsPayloadReader.Factory payloadReaderFactory) {
  this.payloadReaderFactory = Assertions.checkNotNull(payloadReaderFactory);
  this.mode = mode;
  if (mode == MODE_SINGLE_PMT || mode == MODE_HLS) {
    timestampAdjusters = Collections.singletonList(timestampAdjuster);
  } else {
    timestampAdjusters = new ArrayList<>();
    timestampAdjusters.add(timestampAdjuster);
  }
  tsPacketBuffer = new ParsableByteArray(new byte[BUFFER_SIZE], 0);
  trackIds = new SparseBooleanArray();
  trackPids = new SparseBooleanArray();
  tsPayloadReaders = new SparseArray<>();
  continuityCounters = new SparseIntArray();
  durationReader = new TsDurationReader();
  pcrPid = -1;
  resetPayloadReaders();
}
 
@Bean
public Catalog catalog() {
	return new Catalog(Collections.singletonList(
			new ServiceDefinition(
					"mongodb-service-broker",
					"mongodb",
					"A simple MongoDB service broker implementation",
					true,
					false,
					Collections.singletonList(
							new Plan("mongo-plan",
									"default",
									"This is a default mongo plan.  All services are created equally.",
									getPlanMetadata())),
					Arrays.asList("mongodb", "document"),
					getServiceDefinitionMetadata(),
					null,
					null)));
}
 
源代码4 项目: netbeans   文件: SQLExecuteHelper.java
private static List<StatementInfo> getStatements(String script, int startOffset, int endOffset,
        Compatibility compat) {
    if ((startOffset == 0 && endOffset == script.length()) || (startOffset == endOffset)) {
        // Either the whole script, or the statement at offset startOffset.
        List<StatementInfo> allStatements = split(script, compat);
        if (startOffset == 0 && endOffset == script.length()) {
            return allStatements;
        }
        // Just the statement at offset startOffset.
        StatementInfo foundStatement = findStatementAtOffset(
                allStatements, startOffset, script);
        return foundStatement == null
                ? Collections.<StatementInfo>emptyList()
                : Collections.singletonList(foundStatement);
    } else {
        // Just execute the selected subscript.
        return split(script.substring(startOffset, endOffset), compat);
    }
}
 
@Nonnull
@Override
public List<Map<String, Object>> getWithCredentialsParameters(String credentialsId) {
    Map<String, Object> map = new HashMap<>();
    map.put("$class", DockerServerCredentialsBinding.class.getName());
    map.put("variable", new EnvVarResolver());
    map.put("credentialsId", credentialsId);
    return Collections.singletonList(map);
}
 
源代码6 项目: development   文件: AccountServiceWSTest.java
@Test(expected = ValidationException.class)
public void saveUdaDefinitions_EmptyTargetType() throws Exception {
    List<VOUdaDefinition> list = Collections
            .singletonList(createVOUdaDefinition("   ", "UDA", null,
                    UdaConfigurationType.SUPPLIER));
    accountService_Supplier.saveUdaDefinitions(list,
            new ArrayList<VOUdaDefinition>());
}
 
源代码7 项目: TencentKona-8   文件: URICertStore.java
/**
 * Checks if the specified X509CRL matches the criteria specified in the
 * CRLSelector.
 */
private static Collection<X509CRL> getMatchingCRLs
    (X509CRL crl, CRLSelector selector) {
    if (selector == null || (crl != null && selector.match(crl))) {
        return Collections.singletonList(crl);
    } else {
        return Collections.emptyList();
    }
}
 
@Test
public void failsIfNoBufferSizeDisparity() {
  Symptom symptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), Instant.now(), null);
  Collection<Symptom> symptoms = Collections.singletonList(symptom);

  Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
  assertEquals(0, result.size());
}
 
public OrchestrationShardingSphereDataSource(final OrchestrationConfiguration orchestrationConfig) throws SQLException {
    super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME)));
    ConfigCenter configService = getShardingOrchestrationFacade().getConfigCenter();
    Collection<RuleConfiguration> configurations = configService.loadRuleConfigurations(DefaultSchema.LOGIC_NAME);
    Preconditions.checkState(!configurations.isEmpty(), "Missing the sharding rule configuration on registry center");
    Map<String, DataSourceConfiguration> dataSourceConfigurations = configService.loadDataSourceConfigurations(DefaultSchema.LOGIC_NAME);
    dataSource = new ShardingSphereDataSource(DataSourceConverter.getDataSourceMap(dataSourceConfigurations), configurations, configService.loadProperties());
    initShardingOrchestrationFacade();
    disableDataSources();
    persistMetaData(dataSource.getSchemaContexts().getDefaultSchemaContext().getSchema().getMetaData().getSchema());
    initCluster();
}
 
源代码10 项目: wings   文件: PackagedWorkflowManager.java
/**
 * Parse a workflow
 * 
 * @param workflowID
 *          workflow id
 * @param workflowXML
 *          xml representation of the workflow including all tasks
 * @return a workflow
 * @throws RepositoryException
 */
public Workflow parsePackagedWorkflow(String workflowID, String workflowXML)
    throws RepositoryException {
  try {
    File tmpfile = File.createTempFile("tempworkflow-", "-packaged");
    FileUtils.writeStringToFile(tmpfile, workflowXML);
    PackagedWorkflowRepository tmprepo = new PackagedWorkflowRepository(
        Collections.singletonList(tmpfile));
    tmpfile.delete();
    return tmprepo.getWorkflowById(workflowID);
  } catch (Exception e) {
    throw new RepositoryException("Failed to parse workflow xml: "
        + e.getMessage());
  }
}
 
源代码11 项目: ProtocolSupportBungee   文件: RespawnPacket.java
@Override
public Collection<PacketWrapper> toNative() {
	return Collections.singletonList(new PacketWrapper(new Respawn(dimension, 0, (short) difficulty, (short) gamemode, levelType), Unpooled.wrappedBuffer(readbytes)));
}
 
源代码12 项目: deeplearning4j   文件: ScalarMax.java
@Override
public List<SDVariable> doDiff(List<SDVariable> i_v1) {
    SDVariable mask = arg().gt(scalarValue.getDouble(0)).castTo(arg().dataType());
    return Collections.singletonList(i_v1.get(0).mul(mask));
}
 
源代码13 项目: drftpd   文件: PreExtendedPermissions.java
@Override
public List<PermissionDefinition> permissions() {
    PermissionDefinition pre = new PermissionDefinition("pre",
            DefaultConfigHandler.class, "handlePathPerm");
    return Collections.singletonList(pre);
}
 
源代码14 项目: barleydb   文件: GenerateGrapqlSDL.java
public List<Argument> getPrimaryKeyArguments() {
	NodeSpec nt = et.getPrimaryKeyNodes(true).iterator().next();
	return Collections.singletonList(new NodeQueryArgument(nt));
}
 
@Test
void validate_RegistrationContext_with_android_key_attestation_statement_test() {
    String rpId = "example.com";
    Challenge challenge = new DefaultChallenge();
    AuthenticatorSelectionCriteria authenticatorSelectionCriteria =
            new AuthenticatorSelectionCriteria(
                    AuthenticatorAttachment.CROSS_PLATFORM,
                    true,
                    UserVerificationRequirement.REQUIRED);

    PublicKeyCredentialParameters publicKeyCredentialParameters = new PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, COSEAlgorithmIdentifier.ES256);

    PublicKeyCredentialUserEntity publicKeyCredentialUserEntity = new PublicKeyCredentialUserEntity();

    AuthenticationExtensionsClientInputs<RegistrationExtensionClientInput<?>> extensions = new AuthenticationExtensionsClientInputs<>();
    PublicKeyCredentialCreationOptions credentialCreationOptions
            = new PublicKeyCredentialCreationOptions(
            new PublicKeyCredentialRpEntity(rpId, "example.com"),
            publicKeyCredentialUserEntity,
            challenge,
            Collections.singletonList(publicKeyCredentialParameters),
            null,
            Collections.emptyList(),
            authenticatorSelectionCriteria,
            AttestationConveyancePreference.DIRECT,
            extensions
    );

    PublicKeyCredential<AuthenticatorAttestationResponse, RegistrationExtensionClientOutput<?>> credential = clientPlatform.create(credentialCreationOptions);
    AuthenticatorAttestationResponse registrationRequest = credential.getAuthenticatorResponse();
    AuthenticationExtensionsClientOutputs<RegistrationExtensionClientOutput<?>> clientExtensionResults = credential.getClientExtensionResults();
    Set<String> transports = Collections.emptySet();
    String clientExtensionJSON = authenticationExtensionsClientOutputsConverter.convertToString(clientExtensionResults);
    ServerProperty serverProperty = new ServerProperty(origin, rpId, challenge, null);
    RegistrationRequest webAuthnRegistrationRequest
            = new RegistrationRequest(
            registrationRequest.getAttestationObject(),
            registrationRequest.getClientDataJSON(),
            clientExtensionJSON,
            transports
    );
    RegistrationParameters webAuthnRegistrationParameters
            = new RegistrationParameters(
            serverProperty,
            false,
            true,
            Collections.emptyList()
    );

    RegistrationData response = target.validate(webAuthnRegistrationRequest, webAuthnRegistrationParameters);

    assertAll(
            () -> assertThat(response.getCollectedClientData()).isNotNull(),
            () -> assertThat(response.getAttestationObject()).isNotNull(),
            () -> assertThat(response.getClientExtensions()).isNotNull()
    );
}
 
@Override
public Iterable<Expression> getOperands() {
    return Collections.singletonList(((AnyInValueSet) expression).getCodes());
}
 
源代码17 项目: kite   文件: GenerateUUIDBuilder.java
@Override
public Collection<String> getNames() {
  return Collections.singletonList("generateUUID");
}
 
源代码18 项目: IridiumSkyblock   文件: HomeCommand.java
public HomeCommand() {
    super(Collections.singletonList("home"), "Teleport to your island home", "", true);
}
 
源代码19 项目: nd4j   文件: EmbeddedKafkaCluster.java
public EmbeddedKafkaCluster(String zkConnection, Properties baseProperties) {
    this(zkConnection, baseProperties, Collections.singletonList(-1));
}
 
源代码20 项目: openapi-generator   文件: ApiClient.java
/**
 * Convert a URL query name/value parameter to a list of encoded {@link Pair}
 * objects.
 *
 * <p>The value can be null, in which case an empty list is returned.</p>
 *
 * @param name The query name parameter.
 * @param value The query value, which may not be a collection but may be
 *              null.
 * @return A singleton list of the {@link Pair} objects representing the input
 * parameters, which is encoded for use in a URL. If the value is null, an
 * empty list is returned.
 */
public static List<Pair> parameterToPairs(String name, Object value) {
  if (name == null || name.isEmpty() || value == null) {
    return Collections.emptyList();
  }
  return Collections.singletonList(new Pair(urlEncode(name), urlEncode(value.toString())));
}