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


Java Collections.singletonList方法代码示例

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


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

示例1: makeParamsCopy

import java.util.Collections; //导入方法依赖的package包/类
private static List<VariableTree> makeParamsCopy(
                                    List<? extends VariableElement> params,
                                    TreeMaker maker) {
    if (params.isEmpty()) {
        return Collections.emptyList();
    }

    int size = params.size();
    if (size == 1) {
        return Collections.singletonList(makeCopy(params.get(0), maker));
    }

    List<VariableTree> result = new ArrayList(size);
    for (VariableElement param : params) {
        result.add(makeCopy(param, maker));
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AbstractTestGenerator.java

示例2: testRandomVMGitHub

import java.util.Collections; //导入方法依赖的package包/类
@Test // testing full suite
public void testRandomVMGitHub() throws ParseException {

    String shacommit = "c5eafb85390eee59b838a93ae31bc16a5fd4f7b1";
    List<String> fileNames = getFileNamesForTreeSha(shacommit);
    List<String> excludedFiles =
            Collections.singletonList(
                    ""
            );

    for (String fileName : fileNames) {

        if (excludedFiles.contains(fileName)) continue;
        System.out.println("Running: " + fileName);
        String json = JSONReader.loadJSON("VMTests//RandomTests/" + fileName);
        GitHubJSONTestSuite.runGitHubJsonVMTest(json);
    }

}
 
开发者ID:talentchain,项目名称:talchain,代码行数:20,代码来源:GitHubVMTest.java

示例3: playerBalance

import java.util.Collections; //导入方法依赖的package包/类
public Observable<Uint256> playerBalance() {
    Function function = new Function(
            "playerBalance",
            Collections.emptyList(),
            Collections.singletonList(new TypeReference<Uint256>() {
            }));
    return executeCallSingleValueReturnObservable(function);
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:9,代码来源:SlotMachine.java

示例4: getReceiver

import java.util.Collections; //导入方法依赖的package包/类
@Override
public Receiver getReceiver(int minorFragmentId) {
  createSenderReceiverMapping();

  MinorFragmentEndpoint sender = receiverToSenderMapping.get(minorFragmentId);
  if (sender == null) {
    throw new IllegalStateException(String.format("Failed to find sender for receiver [%d]", minorFragmentId));
  }

  return new UnorderedReceiver(this.senderMajorFragmentId, Collections.singletonList(sender), false);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:12,代码来源:UnorderedDeMuxExchange.java

示例5: create

import java.util.Collections; //导入方法依赖的package包/类
@Override
public DateIndexNameProcessor create(Map<String, Processor.Factory> registry, String tag,
                                     Map<String, Object> config) throws Exception {
    String localeString = ConfigurationUtils.readOptionalStringProperty(TYPE, tag, config, "locale");
    String timezoneString = ConfigurationUtils.readOptionalStringProperty(TYPE, tag, config, "timezone");
    DateTimeZone timezone = timezoneString == null ? DateTimeZone.UTC : DateTimeZone.forID(timezoneString);
    Locale locale = Locale.ENGLISH;
    if (localeString != null) {
        try {
            locale = (new Locale.Builder()).setLanguageTag(localeString).build();
        } catch (IllformedLocaleException e) {
            throw new IllegalArgumentException("Invalid language tag specified: " + localeString);
        }
    }
    List<String> dateFormatStrings = ConfigurationUtils.readOptionalList(TYPE, tag, config, "date_formats");
    if (dateFormatStrings == null) {
        dateFormatStrings = Collections.singletonList("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
    }
    List<Function<String, DateTime>> dateFormats = new ArrayList<>(dateFormatStrings.size());
    for (String format : dateFormatStrings) {
        DateFormat dateFormat = DateFormat.fromString(format);
        dateFormats.add(dateFormat.getFunction(format, timezone, locale));
    }

    String field = ConfigurationUtils.readStringProperty(TYPE, tag, config, "field");
    String indexNamePrefix = ConfigurationUtils.readStringProperty(TYPE, tag, config, "index_name_prefix", "");
    String dateRounding = ConfigurationUtils.readStringProperty(TYPE, tag, config, "date_rounding");
    String indexNameFormat = ConfigurationUtils.readStringProperty(TYPE, tag, config, "index_name_format", "yyyy-MM-dd");
    return new DateIndexNameProcessor(tag, field, dateFormats, timezone, indexNamePrefix, dateRounding, indexNameFormat);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:DateIndexNameProcessor.java

示例6: say2

import java.util.Collections; //导入方法依赖的package包/类
public Observable<Uint256> say2(Uint256 input) {
    Function function = new Function(
            "say2",
            Collections.singletonList(input),
            Collections.singletonList(new TypeReference<Uint256>() {
            })
    );

    return executeCallSingleValueReturnObservable(function);
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:11,代码来源:Hello.java

示例7: deserialize

import java.util.Collections; //导入方法依赖的package包/类
@Override
public ChatsInfoResponse deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    List<VKApiChat> chats;

    if(json.isJsonObject()){
        chats = Collections.singletonList(context.deserialize(json, VKApiChat.class));
    } else {
        JsonArray array = json.getAsJsonArray();
        chats = parseArray(array, VKApiChat.class, context, Collections.emptyList());
    }

    ChatsInfoResponse response = new ChatsInfoResponse();
    response.chats = chats;
    return response;
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:16,代码来源:ChatsInfoAdapter.java

示例8: checkAndLogErrors_hasCodeAndCategory

import java.util.Collections; //导入方法依赖的package包/类
@Test public void checkAndLogErrors_hasCodeAndCategory() {
  List<Error> errors = Collections.singletonList(new Error()
      .category(CategoryEnum.INVALID_REQUEST_ERROR)
      .code(CodeEnum.BAD_REQUEST)
      .detail("detail"));
  Errors.checkAndLogErrors(errors, logger);
  verify(logger).error("[INVALID_REQUEST_ERROR:BAD_REQUEST] detail");
}
 
开发者ID:square,项目名称:catalog-api-demo,代码行数:9,代码来源:ErrorTest.java

示例9: onCommand

import java.util.Collections; //导入方法依赖的package包/类
public void onCommand(CommandSender sender, String[] args) throws CommandException {
    Player player = (Player) sender;
    PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(player);

    if (profile.getParty() == null) {
        throw new CommandException(Collections.singletonList("You do not have a party."));
    }

    if (profile.getParty().getLeader().equals(player)) {
        throw new CommandException(Collections.singletonList("You cannot leave your own party. Try using /party disband."));
    }

    PlayerLeavePartyEvent partyEvent = new PlayerLeavePartyEvent(player, profile.getParty(), true, true);
    Bukkit.getPluginManager().callEvent(partyEvent);
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:16,代码来源:PartyLeaveArgument.java

示例10: getPreloadItems

import java.util.Collections; //导入方法依赖的package包/类
@Override
public List<Api.GifResult> getPreloadItems(int position) {
  return Collections.singletonList(results[position]);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:MainActivity.java

示例11: rebalancing

import java.util.Collections; //导入方法依赖的package包/类
private CompositeReadOnlyKeyValueStore<Object, Object> rebalancing() {
    return new CompositeReadOnlyKeyValueStore<>(new WrappingStoreProvider(Collections.<StateStoreProvider>singletonList(new StateStoreProviderStub(true))),
            QueryableStoreTypes.keyValueStore(), storeName);
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:5,代码来源:CompositeReadOnlyKeyValueStoreTest.java

示例12: getViewTypes

import java.util.Collections; //导入方法依赖的package包/类
@Override
public Collection<ViewType> getViewTypes() {
    return Collections.singletonList(ViewType.WEEK_VIEW);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:5,代码来源:TimeRangeField.java

示例13: ICheatReportingServiceGetCheatingReports

import java.util.Collections; //导入方法依赖的package包/类
public ICheatReportingServiceGetCheatingReports(ICheatReportingService steamInterface) {
    super(
        steamInterface,
        "GetCheatingReports",
        Collections.singletonList(
            SteamMethodVersion.create()
                .method(SteamHTTPMethod.GET)
                .hosts(SteamHost.PUBLIC, SteamHost.PARTNER)
                .version(SteamVersion.V_1)
                .visibility(SteamVisibility.PUBLISHER)
                .add(new KeyOption(true))
                .add(new AppIDOption(true))
                .add(new TimeBeginOption(true))
                .add(new TimeEndOption(true))
                .add(new SteamIDOption(false))
                .add(
                    Option.create()
                        .key("reportidmin")
                        .description("Minimum reportID to include.")
                        .optionType(OptionTypes.UINT_64)
                        .isRequired(true)
                    .build()
                )
                .add(
                    Option.create()
                        .key("includereports")
                        .description("Include reports.")
                        .optionType(OptionTypes.BOOL)
                        .isRequired(false)
                    .build()
                )
                .add(
                    Option.create()
                        .key("includebans")
                        .description("Include ban requests.")
                        .optionType(OptionTypes.BOOL)
                        .isRequired(true)
                    .build()
                )
            .build()
        )
    );
}
 
开发者ID:sweetcode,项目名称:SteamAPI,代码行数:44,代码来源:ICheatReportingServiceGetCheatingReports.java

示例14: getAllEditors

import java.util.Collections; //导入方法依赖的package包/类
@Override
protected Collection<EntityEditor<UserScriptEditingBean, UserScript>> getAllEditors()
{
	return Collections.singletonList((EntityEditor<UserScriptEditingBean, UserScript>) userScriptEditorSection);
}
 
开发者ID:equella,项目名称:Equella,代码行数:6,代码来源:UserScriptContributeSection.java

示例15: builder

import java.util.Collections; //导入方法依赖的package包/类
public static Builder builder(String uri) {
  return new Builder(Collections.singletonList(uri));
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:4,代码来源:PeerConnection.java


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