Interface CollectionFilter


public interface CollectionFilter
A collection filter is used by the CrossSection class to filter elements of the source collection.

Imagine to have a list of agents of the class Agent, which contains a boolean variable isFemale and an int variable age.

In order to obtain the list of ages of the males in the collection, the user can crate a class implementing CollectionFilter.

During the cross section iteration of the list, every object is passed to the isFiltered(Object) method and the corresponding value is read only when the filter returns true.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isFiltered(@NonNull Object objectToFilter)
    Returns a boolean value when the passed objectToFilter must be considered by the CrossSection iterator.
  • Method Details

    • isFiltered

      boolean isFiltered(@NonNull @NonNull Object objectToFilter)
      Returns a boolean value when the passed objectToFilter must be considered by the CrossSection iterator.
      Parameters:
      objectToFilter - The current object in the CrossSection iteration of the source collection.
      Returns:
      true if objectToFilter has the required status, false otherwise.