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

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

There is a newer version: 3.8.1
Show newest version
package org.bardframework.commons.sms;

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

public class SmsSenderRanked implements SmsSender {
    private final List senders;

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

    public List getSenders() {
        return 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