src/main/java/org/organicdesign/fp/oneOf/OneOf3.java
@SuppressWarnings("unchecked")
    public <R> R match(Fn1<A, R> fa,
                       Fn1<B, R> fb,
                       Fn1<C, R> fc) {
        if (sel == 0) {
            return fa.apply((A) item);
        } else if (sel == 1) {
            return fb.apply((B) item);
        } else {
            return fc.apply((C) item);
        }
    }
@SuppressWarnings("unchecked")
    public <R> R match(Fn1<A, R> fa,
                       Fn1<B, R> fb,
                       Fn1<C, R> fc) {
        if (sel == 0) {
            return fa.apply((A) item);
        } else if (sel == 1) {
            return fb.apply((B) item);
        } else {
            return fc.apply((C) item);
        }
    }
@ SuppressWarnings ( "unchecked" ) public < R > R match ( Fn1 < A , R > fa , Fn1 < B , R > fb , Fn1 < C , R > fc ) { if ( sel == 0 ) { return fa . apply ( ( A ) item ) ; } else if ( sel == 1 ) { return fb . apply ( ( B ) item ) ; } else { return fc . apply ( ( C ) item ) ; } }
If sel is managed correctly, it ensures that the cast is accurate.
If sel is managed correctly it ensures that the cast is accurate .