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

com.jnape.palatable.lambda.functions.builtin.fn1.Magnetize Maven / Gradle / Ivy

There is a newer version: 5.5.0
Show newest version
package com.jnape.palatable.lambda.functions.builtin.fn1;

import com.jnape.palatable.lambda.functions.Fn1;

import static com.jnape.palatable.lambda.functions.builtin.fn2.Eq.eq;
import static com.jnape.palatable.lambda.functions.builtin.fn2.MagnetizeBy.magnetizeBy;

/**
 * {@link Magnetize} an {@link Iterable} using value equality as the magnetizing function.
 *
 * @param  the Iterable element type
 */
public final class Magnetize implements Fn1, Iterable>> {

    private static final Magnetize INSTANCE = new Magnetize<>();

    private Magnetize() {
    }

    @Override
    public Iterable> checkedApply(Iterable as) {
        return magnetizeBy(eq(), as);
    }

    @SuppressWarnings("unchecked")
    public static  Magnetize magnetize() {
        return (Magnetize) INSTANCE;
    }

    public static  Iterable> magnetize(Iterable as) {
        return Magnetize.magnetize().apply(as);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy