두 개의 목록이 있습니다. 하나는 모든 폴더 목록을 반환하고 다른 하나는 최근 폴더 목록을 반환합니다. 내가하고 싶은 것은 각리스트를 서로 비교하는 것입니다. 일치하는 것이 발견되면 건배를 표시하십시오.두 목록을 비교하여 차이를 계산하십시오 - Android/Java
boolean currentFolderFound = false;
if (mAllFolderListCursor != null) {
final String folderName = mSelectedFolderUri.toString();
if (mAllFolderListCursor.moveToFirst()) {
do {
final Folder f = mAllFolderListCursor.getModel();
if (!isFolderTypeExcluded(f)) {
if (f.folderUri.equals(mRecentFolders)) {
Toast.makeText(getApplicationContext(), "MATCH FOUND",
Toast.LENGTH_LONG).show();
}
}
} while (!currentFolderFound && mAllFolderListCursor.moveToNext());
}
}
내가 선을 코딩 한 생각 : 다음과 같이
나의 현재 코드는 (f.folderUri.equals(mRecentFolders)) {
경우 잘못 - 그리고 나는 이것이 내가 찾고 있어요 결과를 제공하기 위해 개선 될 수 있는지 궁금하네요. 객체가 실제로 동일한 경우 사전에
감사합니다,
크리스토퍼
당신이 거기서 비교할 수있는 것들에 따라 작동 할지도 모르는'if (mRecentFolders.contains (f.folderUri)) '와 같은 것을 원할 것입니다. – zapl