Skip to content

Instantly share code, notes, and snippets.

View Doc1faux's full-sized avatar

Sébastien Vitard Doc1faux

View GitHub Profile
@Doc1faux
Doc1faux / LocaleUtils.java
Created February 22, 2022 09:36
A one-shot function to get a default country for a locale. I was needed this method in order to display a country flag from a language code only (ISO 639-2 & 639-3)
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public final class LocaleUtils