Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any problem using singleton? [Question] #57

Open
raizoor opened this issue Aug 27, 2020 · 0 comments
Open

Any problem using singleton? [Question] #57

raizoor opened this issue Aug 27, 2020 · 0 comments

Comments

@raizoor
Copy link

raizoor commented Aug 27, 2020

Hi Team,

Can anyone imagine or already get any problem to use a that lib (RatcliffObershelp specificly) in a Singleton class?

My use :

import info.debatty.java.stringsimilarity.RatcliffObershelp;

public class StringSimilarityCalculator {

    private static StringSimilarityCalculator stringSimilarityCalculator;
    private static RatcliffObershelp calculo = new RatcliffObershelp();
    private static final double minSimilaridadeEndereco = 0.90;

    private StringSimilarityCalculator(){}

    public static StringSimilarityCalculator getInstance() {

        if(stringSimilarityCalculator == null){

            stringSimilarityCalculator = new StringSimilarityCalculator();
        }

        return stringSimilarityCalculator;
    }

    public boolean isStringEnderecoSimilar(String enderecoPagador, String enderecoPagadorBanco){

        return calculo.similarity(enderecoPagador.toLowerCase(),
                enderecoPagadorBanco.toLowerCase()) >= minSimilaridadeEndereco;
    }
}

Thanks !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant