Skip to content

io microsphere filter FilterUtils

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

FilterUtils

Type: Class | Module: microsphere-java-core | Package: io.microsphere.filter | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/filter/FilterUtils.java

Overview

Utility class for working with Filter instances. Provides static helper methods to apply filters to collections and iterate over filtered results.

This class also implements the marker interface Utils, indicating it is part of the utility framework.

Example Usage

`// Filtering a collection using a single filter
    List filteredList = FilterUtils.filter(stringList, new Filter() {
        public boolean accept(String s) {
            return s.startsWith("A");
        `
    });

    // Filtering using multiple filters with AND operator
    List filteredWithAnd = FilterUtils.filter(stringList, FilterOperator.AND,
        new Filter() { ... },
        new Filter() { ... }
    );

    // Filtering using multiple filters with OR operator
    List filteredWithOr = FilterUtils.filter(stringList, FilterOperator.OR,
        new Filter() { ... },
        new Filter() { ... }
    );
}

Declaration

public abstract class FilterUtils implements Utils

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

// Filtering a collection using a single filter
    List<String> filteredList = FilterUtils.filter(stringList, new Filter<String>() {
        public boolean accept(String s) {
            return s.startsWith("A");
        }
    });

    // Filtering using multiple filters with AND operator
    List<String> filteredWithAnd = FilterUtils.filter(stringList, FilterOperator.AND,
        new Filter<String>() { ... },
        new Filter<String>() { ... }
    );

    // Filtering using multiple filters with OR operator
    List<String> filteredWithOr = FilterUtils.filter(stringList, FilterOperator.OR,
        new Filter<String>() { ... },
        new Filter<String>() { ... }
    );

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.filter.FilterUtils;

API Reference

Public Methods

Method Description
filter Filter Iterable object to List
filter Filter Iterable object to List

See Also

  • Filter
  • FilterOperator

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally