Class CollectionFilter<T>

java.lang.Object
games.stendhal.common.filter.CollectionFilter<T>
Type Parameters:
T - generic type of collection elements

public class CollectionFilter<T> extends Object

Title: CollectionFilter.

Description:

Version:
1.0
Author:
David Rappoport
  • Constructor Details

    • CollectionFilter

      public CollectionFilter()
  • Method Details

    • addFilterCriteria

      public void addFilterCriteria(FilterCriteria<T> filterCriteria)
      Adds a FilterCriteria to be used by the filter.
      Parameters:
      filterCriteria - criteria for the filter
    • filter

      public void filter(Collection<T> collection)
      Starts the filtering process. For each object in the collection, all FilterCriteria are called. Only if the object passes all FilterCriteria it remains in the collection. Otherwise, it is removed.
      Parameters:
      collection - collection to filter
    • filterCopy

      public Collection<? extends T> filterCopy(Collection<? extends T> inputCollection)
      This method does the same as the filter method. However, a copy of the original collection is created and filtered. The original collection remains unchanged and the copy is returned. Only use this method for collection classes that define a default constructor
      Parameters:
      inputCollection - collection to copy
      Returns:
      a filtered copy of the input collection