本文整理匯總了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.");
}
}