本文整理汇总了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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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");
}
示例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);
}
示例10: getPreloadItems
import java.util.Collections; //导入方法依赖的package包/类
@Override
public List<Api.GifResult> getPreloadItems(int position) {
return Collections.singletonList(results[position]);
}
示例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);
}
示例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()
)
);
}
示例14: getAllEditors
import java.util.Collections; //导入方法依赖的package包/类
@Override
protected Collection<EntityEditor<UserScriptEditingBean, UserScript>> getAllEditors()
{
return Collections.singletonList((EntityEditor<UserScriptEditingBean, UserScript>) userScriptEditorSection);
}
示例15: builder
import java.util.Collections; //导入方法依赖的package包/类
public static Builder builder(String uri) {
return new Builder(Collections.singletonList(uri));
}