Javazzs:
私は、内の単語のすべての出現を削除するArrayList
指定した文字列から。
私は私のフレーム上の3つのボタンがあります。単語を追加一、第二、その削除し語、及びショーの単語、第3。
私は名前のテキストボックス持っtextvalue
た名前を持つ、配列リストmylist
私が使用しました:
textValue = text.getText().toLowerCase().trim();
if (mylist.contains(textValue)) {
mylist.removeAll(Arrays.asList(textValue));
label.setText("All occurrences of " + textValue + "removed");
} else {
label.setText("Word not found.");
}
私は、例えば置く場合:マークとMARK、それはまだのみ削除マークになります。
私も試してみました:
textValue = text.getText().toLowerCase().trim();
for (String current : mylist) {
if (current.equalsIgnoreCase(textValue)) {
mylist.removeAll(Collections.singleton(textValue));
label.setText("All occurrences of " + textValue + " removed");
} else {
label.setText("Word not found.");
}
}