java.text.SimpleDateFormat.getAvailableLocales()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中java.text.SimpleDateFormat.getAvailableLocales()方法的一些代码示例,展示了SimpleDateFormat.getAvailableLocales()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimpleDateFormat.getAvailableLocales()方法的具体详情如下:
包路径:java.text.SimpleDateFormat
类名称:SimpleDateFormat
方法名:getAvailableLocales

SimpleDateFormat.getAvailableLocales介绍

暂无

代码示例

代码示例来源:origin: org.apache.sling/org.apache.sling.cms.core

public List<Locale> getLocales() {
  List<Locale> locales = new ArrayList<>();
  for (Locale locale : SimpleDateFormat.getAvailableLocales()) {
    locales.add(locale);
  }
  Collections.sort(locales, new Comparator<Locale>() {
    public int compare(Locale o1, Locale o2) {
      return o1.toString().compareTo(o2.toString());
    }
  });
  return locales;
}

代码示例来源:origin: remibantos/jeeshop

static public void main(String[] args) {

      Locale[] availableLocales = SimpleDateFormat.getAvailableLocales();
      List<Locale> list = new ArrayList<Locale>(Arrays.asList(availableLocales));
      list.remove(0);

      TreeSet<String> set = new TreeSet<>();
      int localeLength = 0;
      for (Locale a : list) {
        if (a.toString().length()>localeLength)
          localeLength = a.toString().length();

        set.add("{displayName:\"" + a.getDisplayName(Locale.ENGLISH) + "\"," + "name:\"" + a.toString() + "\"},");
      }

      System.out.println(localeLength);
      String buff = "";
      for (String i : set){
;               buff += i;
        if (buff.length()>160){
          System.out.println(buff);
          buff ="";
        }

      }

    }

相关文章

SimpleDateFormat类方法