代码:
String[] myStringArray = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
String input = "Monday"
输出:
String[] newInput = {"Tuesday","Wednesday","Thursday","Friday","Saturday"};
那么如何在java中删除要在数组中更新的特定输入?
答案 0 :(得分:1)
试试这个:
public static void main(final String[] args) {
String[] myStringArray = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
String input = "Monday";
String[] output = Arrays.stream(myStringArray).filter(e -> !e.equals(input)).toArray(String[]::new);
System.out.println(Arrays.toString(output));
}
答案 1 :(得分:0)
<!-- Example div -->
<div id="test"></div>
真正可怕的代码片段,但我希望它有所帮助 - 我尽可能保持简单。