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

io.github.vipcxj.jasync.spec.switchexpr.IntCase Maven / Gradle / Ivy

Go to download

JAsync implements Async-Await fashion for Java just like es and c#. This library provide the spec of all public api.

There is a newer version: 1.0.17
Show newest version
package io.github.vipcxj.jasync.spec.switchexpr;

import io.github.vipcxj.jasync.spec.functional.VoidPromiseSupplier;

public class IntCase implements ICase {
    private final int cond;
    private final VoidPromiseSupplier body;

    public IntCase(int cond, VoidPromiseSupplier body) {
        this.cond = cond;
        this.body = body;
    }

    public int getCond() {
        return cond;
    }

    @Override
    public VoidPromiseSupplier getBody() {
        return body;
    }

    public boolean is(int v, boolean findingDefault) {
        return !findingDefault && v == cond;
    }

    @Override
    public boolean is(Integer v, boolean findingDefault) {
        return !findingDefault && v != null && v == cond;
    }

    public static IntCase of(int cond, VoidPromiseSupplier body) {
        return new IntCase(cond, body);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy