Created
August 18, 2014 06:26
-
-
Save srcreigh/9651f643ad0cb7d11c12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set<WeakReference<TextView>> toRemove = new HashSet<WeakReference<TextView>>(); | |
for (WeakReference<TextView> weakRef : textviews) { | |
TextView textView = weakRef.get(); | |
if (textView != null) { | |
// do stuff here | |
} else { | |
toRemove.add(weakRef); | |
} | |
} | |
// remove all the unnecessary WeakReferences from your set | |
textviews.removeAll(toRemove); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment