本文整理汇总了Java中org.apache.commons.lang3.ArrayUtils.remove方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils.remove方法的具体用法?Java ArrayUtils.remove怎么用?Java ArrayUtils.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.ArrayUtils
的用法示例。
在下文中一共展示了ArrayUtils.remove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: route
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public RouteDef route(String path){
String[] ruta = path.split("/");
if(ruta.length > 0){
if(this.RouteMap.containsKey(ruta[0])){
RouteDef rt = this.RouteMap.get(ruta[0]);
ruta = ArrayUtils.remove(ruta,0);
RouteDef enrutado = rt.route(ruta);
return enrutado;
}
else
{
return null;
}
}
else
{
return null;
}
}
示例2: DBRowBatchHandler
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public DBRowBatchHandler(HandlerContext<T> context, JdbcTemplate jdbcTemplate) {
super(context);
this.jdbcTemplate = jdbcTemplate;
Class<T> clazz = context.getClazz();
fields = clazz.getDeclaredFields();
for(int i=0;i<fields.length;i++){
if(fields[i].getName().equals("serialVersionUID")){
fields = ArrayUtils.remove(fields, i);
break;
}
}
initDBMetaData();
prepareSql();
}
示例3: run
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public Result run(String[] argsOrig, MessageReceivedEvent e) {
//Check for proper argument length
if (argsOrig.length < 2) {
return new Result(Outcome.WARNING, ":warning: Please specify a message.");
}
//Extract channel
String[] args = ArrayUtils.remove(MessageUtils.getContent(e.getMessage(), true), 0);
TextChannel channel = null;
if (args[0].matches(MessageUtils.channelRegex)) {
channel = e.getMessage().getMentionedChannels().get(0);
} else if (args[0].matches(MessageUtils.idRegex)) {
channel = DiscordUtils.getTextChannelById(args[0]);
} else {
return new Result(Outcome.ERROR, ":x: Not a valid channel!");
}
//Send the message
String msg = String.join(" ", ArrayUtils.remove(args, 0));
channel.sendMessage(msg).queue();
//Log it
EmbedBuilder eb = new EmbedBuilder();
Guild guild = channel.getGuild();
eb.setAuthor(e.getAuthor().getName() + " (" + e.getAuthor().getId() + ")",
null, e.getAuthor().getAvatarUrl());
eb.setDescription("**Sent a msg to `" + channel.getName() + "` (" + channel.getId() + ")**\non `" +
guild.getName() + "` (" + guild.getId() + "):\n" + msg);
eb.setThumbnail(guild.getIconUrl());
MessageUtils.log(eb.build());
return new Result(Outcome.SUCCESS);
}
示例4: keyTyped
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
protected void keyTyped(char par1, int par2) throws IOException {
if (par2 == Keyboard.KEY_ESCAPE) {
NetworkHandler.sendToServer(new PacketAphorismTileUpdate(tile));
} else if (par2 == Keyboard.KEY_LEFT || par2 == Keyboard.KEY_UP) {
cursorY--;
if (cursorY < 0) cursorY = textLines.length - 1;
} else if (par2 == Keyboard.KEY_DOWN || par2 == Keyboard.KEY_NUMPADENTER) {
cursorY++;
if (cursorY >= textLines.length) cursorY = 0;
} else if (par2 == Keyboard.KEY_RETURN) {
cursorY++;
textLines = ArrayUtils.add(textLines, cursorY, "");
} else if (par2 == Keyboard.KEY_BACK) {
if (textLines[cursorY].length() > 0) {
textLines[cursorY] = textLines[cursorY].substring(0, textLines[cursorY].length() - 1);
if (textLines[cursorY].endsWith("\u00a7")) {
textLines[cursorY] = textLines[cursorY].substring(0, textLines[cursorY].length() - 1);
}
} else if (textLines.length > 1) {
textLines = ArrayUtils.remove(textLines, cursorY);
cursorY--;
if (cursorY < 0) cursorY = 0;
}
} else if (par2 == Keyboard.KEY_DELETE) {
if (GuiScreen.isShiftKeyDown()) {
textLines = new String[1];
textLines[0] = "";
cursorY = 0;
} else {
if (textLines.length > 1) {
textLines = ArrayUtils.remove(textLines, cursorY);
if (cursorY > textLines.length - 1)
cursorY = textLines.length - 1;
}
}
} else if (ChatAllowedCharacters.isAllowedCharacter(par1)) {
if (GuiScreen.isAltKeyDown()) {
if (par1 >= 'a' && par1 <= 'f' || par1 >= 'l' && par1 <= 'o' || par1 == 'r' || par1 >= '0' && par1 <= '9') {
textLines[cursorY] = textLines[cursorY] + "\u00a7" + par1;
}
} else {
textLines[cursorY] = textLines[cursorY] + par1;
}
}
tile.setTextLines(textLines);
super.keyTyped(par1, par2);
}
示例5: read
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public static void read(File file) {
//Look for client token
String[] args = Bot.args;
if (args.length > 1 && ArrayUtils.contains(args, "-t")) {
int index = ArrayUtils.indexOf(args, "-t");
if (index + 1 < args.length) {
args = ArrayUtils.remove(args, index);
String token = args[index];
if (token.matches("{32,}")) {
System.out.println("Found custom client token: " + token);
clientToken = token;
args = ArrayUtils.remove(args, index);
}
Bot.args = args;
}
}
try {
//Parse config JSON
JSONObject config = new JSONObject(FileUtils.readFileToString(file, "UTF-8"));
if (clientToken == null) {
clientToken = config.getString("clientToken");
}
shardCount = config.getInt("shardCount");
if (shardCount < 1) shardCount = 1;
owner = config.getString("owner");
devMode = config.getBoolean("devMode");
debugMode = config.getBoolean("debugMode");
logJDA = config.getBoolean("logJDA");
logChannel = config.getString("logChannel");
sendServerCount = config.getBoolean("sendServerCount");
pwToken = config.getString("pwToken");
netToken = config.getString("netToken");
orgToken = config.getString("orgToken");
game = config.getString("game");
name = config.getString("name");
prefix = config.getString("prefix");
respondToMentions = config.getBoolean("respondToMentions");
notificationTime = config.getInt("notificationTime");
deleteCommands = config.getBoolean("deleteCommands");
sendTyping = config.getBoolean("sendTyping");
invite = config.getString("invite");
showMemory = config.getBoolean("showMemory");
elevatedSkipCooldown = config.getBoolean("elevatedSkipCooldown");
JSONArray eu = config.getJSONArray("elevatedUsers");
for (int i = 0; i < eu.length(); i++) {
elevatedUsers.add(eu.getString(i));
}
} catch (JSONException | IOException e) {
e.printStackTrace();
}
}
示例6: run
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public Result run(String[] argsOrig, MessageReceivedEvent e) {
//Check for proper argument length
if (argsOrig.length < 2) {
return new Result(Outcome.WARNING, ":warning: Please specify a message.");
}
//Extract user
String[] args = ArrayUtils.remove(MessageUtils.getContent(e.getMessage(), true), 0);
User user = null;
if (args[0].matches(MessageUtils.mentionRegex)) {
user = e.getMessage().getMentionedUsers().get(0);
if (user.getId() == e.getJDA().getSelfUser().getId()) {
user = e.getMessage().getMentionedUsers().get(1);
}
} else if (args[0].matches(MessageUtils.idRegex)) {
user = e.getJDA().getUserById(args[0]);
} else {
return new Result(Outcome.ERROR, ":x: Not a valid user!");
}
//Send the message
String msg = null;
try {
PrivateChannel channel = user.openPrivateChannel().submit().get();
msg = String.join(" ", ArrayUtils.remove(args, 0));
channel.sendMessage(msg).queue();
} catch (InterruptedException | ExecutionException ex) {
ex.printStackTrace();
return new Result(Outcome.ERROR, ":x: An exception occured.");
}
EmbedBuilder eb = new EmbedBuilder();
eb.setAuthor(e.getAuthor().getName() + " (" + e.getAuthor().getId() + ")",
null, e.getAuthor().getAvatarUrl());
eb.setDescription("**Sent a DM to " + user.getName() + " (" + user.getId() + "):**\n" + msg);
eb.setThumbnail(user.getAvatarUrl());
MessageUtils.log(eb.build());
return new Result(Outcome.SUCCESS);
}
示例7: run
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public Result run(String[] argsOrig, MessageReceivedEvent e) {
//Check for proper argument length
if (argsOrig.length < 1) {
return new Result(Outcome.WARNING, ":warning: Please specify a guild.");
}
//Get guild
String[] args = ArrayUtils.remove(MessageUtils.getContent(e.getMessage(), true), 0);
Guild guild = null;
if (args[0].matches(MessageUtils.idRegex)) {
guild = DiscordUtils.getGuildById(args[0]);
} else {
return new Result(Outcome.ERROR, ":x: Not a valid guild!");
}
//Check for permissions
if (!guild.getSelfMember().hasPermission(Permission.NICKNAME_CHANGE)) {
return new Result(Outcome.WARNING, ":warning: No permissions!");
}
//Set the nickname
String name = Config.getName();
if (args.length > 1) {
name = String.join(" ", ArrayUtils.remove(args, 0));
}
guild.getController().setNickname(guild.getSelfMember(), name).queue();
//Log it
EmbedBuilder eb = new EmbedBuilder();
eb.setAuthor(e.getAuthor().getName() + " (" + e.getAuthor().getId() + ")",
null, e.getAuthor().getAvatarUrl());
String desc = null;
if (args.length == 1) {
desc = "**Reset nickname on `" + guild.getName() + "` (" + guild.getId() + "):**";
} else {
desc = "**Changed nickname on `" + guild.getName() + "` (" + guild.getId() + "):**\n" + name;
}
eb.setDescription(desc);
eb.setThumbnail(guild.getIconUrl());
MessageUtils.log(eb.build());
return new Result(Outcome.SUCCESS);
}