これを行うにはより良い方法がありますか? 私はJava 8を使用しています。ストリームでこれを行いますが、これを行うには何らかの助けが必要です。私はそれを試してみました... removeIf()が動作しませんでした。JavaにはリストAのオブジェクトがリストに含まれていないb
final List<CalendarEventUserConnection> calendarEventUserConnectionsToDelete = new ArrayList<>();
for (final CalendarEventUserConnection existingCalendarEventUserConnection : existingCalendarEventUserConnections) {
boolean contains = false;
for (final CalendarEventUserConnection newCalendarEventUserConnection : calendarEventUserConnections) {
if (newCalendarEventUserConnection.getId() != null
&& newCalendarEventUserConnection.getId().equals(existingCalendarEventUserConnection.getId())) {
contains = true;
}
}
if (contains == false) {
calendarEventUserConnectionsToDelete.add(existingCalendarEventUserConnection);
}
}
この質問をするには良い方法がありますか?それはほとんど情報を含んでいません。 – Adam
これを行う - 「これ」とは何ですか?あなたが説明できない場合は、確かに –
にはなりません。 20文字以上の変数名は使用しないでください。 '== false'を使わないでください。これは '!'演算子のためのものです。 –