All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.virtdata.libbasics.shared.unary_string.StringFlow Maven / Gradle / Ivy

There is a newer version: 2.12.15
Show newest version
package io.virtdata.libbasics.shared.unary_string;

import io.virtdata.annotations.Categories;
import io.virtdata.annotations.Category;
import io.virtdata.annotations.ThreadSafeMapper;

import java.util.function.Function;

/**
 * Combine multiple String functions together into one function.
 */
@Categories(Category.functional)
@ThreadSafeMapper
public class StringFlow implements Function {

    private final Function[] funcs;

    public StringFlow(Function... funcs) {
        this.funcs = funcs;
    }

    @Override
    public String apply(String s) {
        String value = s;
        for (Function func : funcs) {
            value = func.apply(value);
        }
        return value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy