Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/main/java/de/danielbechler/util/Collections.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,20 @@ public static <T> int indexOf(final Iterable<? extends T> haystack, final T need
public static <T> Collection<? extends T> filteredCopyOf(final Collection<? extends T> source,
final Collection<? extends T> filter)
{
// Patched : Replaces collection and arrayList by HashSet to improve the removeAll performance using the
// implementation of contains() of the hashset
final Collection<T> copy;
if (source != null)
{
copy = new LinkedList<T>(source);
copy = new HashSet<T>(source);
}
else
{
copy = new LinkedList<T>();
copy = new HashSet<T>();
}
if (filter != null)
{
copy.removeAll(new ArrayList<T>(filter));
copy.removeAll(new HashSet<T>(filter));
}
return copy;
}
Expand Down