本文整理汇总了Java中org.apache.commons.lang3.ArrayUtils.removeAll方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils.removeAll方法的具体用法?Java ArrayUtils.removeAll怎么用?Java ArrayUtils.removeAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.ArrayUtils
的用法示例。
在下文中一共展示了ArrayUtils.removeAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeWithConfig
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
protected void executeWithConfig(CommandEvent commandEvent, Config config) {
final User user = commandEvent.getAuthor();
final String userName = user.getName();
final String[] args = commandEvent.getArgs().split(" ");
if (args.length < 2) {
throw new UserMessedUpException(userName,
localeService.getMessageFor(LocaleService.BAD_SYNTAX, localeService.getLocaleForUser(user),
"!raid hatch Ho-Oh solna platform"));
}
String pokemonName = args[0].trim().toLowerCase();
final String[] gymArguments = ArrayUtils.removeAll(args, 0);
String gymName = StringUtils.join(gymArguments, " ");
final String region = config.getRegion();
final Gym gym = gymRepository.search(user, gymName, region);
final Raid raid = raidRepository.getActiveRaidOrFallbackToExRaid(gym, region, user);
final Pokemon pokemon = pokemonRepository.search(pokemonName, user);
final PokemonRaidInfo existingRaidInfo = raidStrategyService.getRaidInfo(raid.getPokemon());
final int newBossTier = raidStrategyService.getRaidInfo(pokemon).getBossTier();
if (!raid.getPokemon().isEgg()) {
throw new UserMessedUpException(user,
localeService.getMessageFor(LocaleService.EGG_ALREADY_HATCHED,
localeService.getLocaleForUser(user), raid.getPokemon().toString()));
}
if (pokemon.isEgg() || newBossTier != existingRaidInfo.getBossTier()) {
throw new UserMessedUpException(user, localeService.getMessageFor(LocaleService.EGG_WRONG_TIER,
localeService.getLocaleForUser(user)));
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Trying to hatch raid " + raid + " into " + pokemonName);
}
AlterRaidCommand.changePokemon(this, gymRepository, localeService, pokemonRepository, raidRepository,
commandEvent, config, user, userName, pokemonName,
gymArguments);
}
示例2: attemptUnsignFromMinusCommand
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private void attemptUnsignFromMinusCommand(GuildMessageReceivedEvent guildMessageReceivedEvent, String[] splitArguments) {
final String numberOfPeopleArgument = splitArguments[0];
final String[] gymArgument = ArrayUtils.removeAll(splitArguments, 0);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Trying to remove " + numberOfPeopleArgument + " from raid, gym " +
StringUtils.join(gymArgument, " "));
}
final String guild = guildMessageReceivedEvent.getGuild().getName().trim().toLowerCase();
final Config configForServer = serverConfigRepository.getConfigForServer(guild);
final User user = guildMessageReceivedEvent.getAuthor();
String message;
try {
message = raidRepository.executeUnsignCommand(configForServer, user,
localeService.getLocaleForUser(user),
splitArguments, "signup");
guildMessageReceivedEvent.getMessage().addReaction(Emotes.OK).queue();
ConfigAwareCommand.removeOriginMessageIfConfigSaysSo(configForServer, guildMessageReceivedEvent);
} catch (Throwable t) {
LOGGER.debug("Unsign command failed: " + t.getMessage());
message = t.getMessage() + "\n\n" +
"Syntax: *-1 Solna Platform*";
guildMessageReceivedEvent.getMessage().addReaction(Emotes.ERROR).queue();
ConfigAwareCommand.removeOriginMessageIfConfigSaysSo(configForServer, guildMessageReceivedEvent);
}
if (!StringUtils.isEmpty(message)) {
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(null, null, null);
embedBuilder.setTitle(null);
embedBuilder.setDescription(message);
final String msgRemoveText =
localeService.getMessageFor(LocaleService.KEEP_CHAT_CLEAN,
localeService.getLocaleForUser(user),
"15");
embedBuilder.setFooter(msgRemoveText, null);
guildMessageReceivedEvent.getMessage().getChannel().sendMessage(embedBuilder.build())
.queue(msg -> {
msg.delete().queueAfter(15, TimeUnit.SECONDS); // Clean up feedback after x seconds
}
);
LOGGER.debug("Removed signup.");
}
}
示例3: attemptSignUpFromPlusCommand
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private void attemptSignUpFromPlusCommand(GuildMessageReceivedEvent guildMessageReceivedEvent, String[] splitArguments) {
final String numberOfPeopleArgument = splitArguments[0];
final String etaArgument = splitArguments[1];
final String[] gymArgument = ArrayUtils.removeAll(splitArguments, 0, 1);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Trying to add " + numberOfPeopleArgument + " to raid, ETA " + etaArgument + " to gym " +
StringUtils.join(gymArgument, " "));
}
final String guild = guildMessageReceivedEvent.getGuild().getName().trim().toLowerCase();
final Config configForServer = serverConfigRepository.getConfigForServer(guild);
final User user = guildMessageReceivedEvent.getAuthor();
String message;
try {
message = raidRepository.executeSignUpCommand(configForServer, user,
localeService.getLocaleForUser(user),
splitArguments, "signup");
guildMessageReceivedEvent.getMessage().addReaction(Emotes.OK).queue();
ConfigAwareCommand.removeOriginMessageIfConfigSaysSo(configForServer, guildMessageReceivedEvent);
} catch (Throwable t) {
LOGGER.debug("Signup plus command failed: " + t.getMessage());
message = t.getMessage() + "\n\n" +
"Syntax: *+1 09:45 Solna Platform*";
guildMessageReceivedEvent.getMessage().addReaction(Emotes.ERROR).queue();
ConfigAwareCommand.removeOriginMessageIfConfigSaysSo(configForServer, guildMessageReceivedEvent);
}
if (!StringUtils.isEmpty(message)) {
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(null, null, null);
embedBuilder.setTitle(null);
embedBuilder.setDescription(message);
final String msgRemoveText =
localeService.getMessageFor(LocaleService.KEEP_CHAT_CLEAN,
localeService.getLocaleForUser(user), "15");
embedBuilder.setFooter(msgRemoveText, null);
guildMessageReceivedEvent.getMessage().getChannel().sendMessage(embedBuilder.build())
.queue(msg -> {
msg.delete().queueAfter(15, TimeUnit.SECONDS); // Clean up feedback after x seconds
}
);
LOGGER.debug("Added signup.");
}
}