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

org.bardframework.commons.sms.SmsSenderRanked Maven / Gradle / Ivy

The newest version!
package org.bardframework.commons.sms;

import lombok.Getter;

import java.io.IOException;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Stack;

@Getter
public class SmsSenderRanked implements SmsSender {
    private final List senders;

    public SmsSenderRanked(List senders) {
        this.senders = senders;
    }

    @Override
    public boolean send(Map args) throws IOException {
        Stack sendersStack = new Stack<>();
        this.senders.stream().sorted(this.comparator()).forEach(sendersStack::add);
        return sendersStack.pop().send(args);
    }

    protected Comparator comparator() {
        return (o1, o2) -> 0;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy