Example usage for java.lang String CASE_INSENSITIVE_ORDER

List of usage examples for java.lang String CASE_INSENSITIVE_ORDER

Introduction

In this page you can find the example usage for java.lang String CASE_INSENSITIVE_ORDER.

Prototype

Comparator CASE_INSENSITIVE_ORDER

To view the source code for java.lang String CASE_INSENSITIVE_ORDER.

Click Source Link

Document

A Comparator that orders String objects as by compareToIgnoreCase .

Usage

From source file:cn.edu.zjnu.acm.judge.config.LocaleFactory.java

public LocaleFactory() {
    Collection<String> set = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
    set.addAll(Arrays.asList("en", "zh"));
    this.allLanguages = set;
}

From source file:Main.java

public static String generateBgsid(HashMap hashmap) {
    StringBuffer stringbuffer = new StringBuffer();
    ArrayList arraylist = new ArrayList();
    for (Iterator iterator = hashmap.entrySet().iterator(); iterator.hasNext(); arraylist
            .add(((java.util.Map.Entry) iterator.next()).getKey())) {
    }/*w  w  w .j a v  a  2  s. c o m*/
    Collections.sort(arraylist, String.CASE_INSENSITIVE_ORDER);
    for (Iterator iterator1 = arraylist.iterator(); iterator1.hasNext(); stringbuffer
            .append((String) hashmap.get((String) iterator1.next()))) {
    }
    stringbuffer.append("c18c24046606b2e084edd37f9fe9f94d");
    return md5(stringbuffer.toString());
}

From source file:main.java.net.bornil.utils.CaseInsensitiveComparator.java

@Override
public int compare(String s1, String s2) {
    assert s1 != null && s2 != null;
    return String.CASE_INSENSITIVE_ORDER.compare(s1, s2);
}

From source file:org.apache.usergrid.persistence.index.utils.MapUtils.java

@SuppressWarnings("unchecked")
public static <A, B> void addMapSet(Map<A, Set<B>> map, boolean ignoreCase, A a, B b) {

    Set<B> setB = map.get(a);
    if (setB == null) {
        if (ignoreCase && (b instanceof String)) {
            setB = (Set<B>) new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
        } else {//  ww  w.  j  a  v  a  2  s  . c  om
            setB = new LinkedHashSet<B>();
        }
        map.put(a, setB);
    }
    setB.add(b);
}

From source file:com.thinkbiganalytics.servicemonitor.support.ServiceMonitorCheckUtil.java

/**
 * get a map of the Service and any components that should be checked within that service.
 *//* ww  w .j a  v  a2  s  .  c  om*/
public static Map<String, List<String>> getMapOfServiceAndComponents(String services) {
    Map<String, List<String>> map = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
    if (StringUtils.isNotBlank(services)) {
        String finalServiceString = services;
        if (services.contains("/")) {
            int i = 1;
            String serviceName = null;
            for (String servicePart : StringUtils.split(services, "/")) {
                //service name is the first string before the /

                if (serviceName == null) {
                    if (servicePart.contains(",")) {
                        serviceName = StringUtils.substringAfterLast(servicePart, ",");
                    } else {
                        serviceName = servicePart;
                    }
                } else {
                    String components = "";
                    String origComponents = "";
                    if (servicePart.contains("]")) {
                        components = StringUtils.substringBeforeLast(servicePart, "]");
                        components = StringUtils.substringAfter(components, "[");
                        origComponents = "[" + components + "]";
                    } else {
                        components = StringUtils.substringBefore(servicePart, ",");
                        origComponents = components;
                    }
                    String[] componentsArr = StringUtils.split(components, ",");
                    map.put(serviceName, Arrays.asList(componentsArr));

                    //now remove these from the finalServiceString
                    finalServiceString = StringUtils.replace(finalServiceString,
                            serviceName + "/" + origComponents, "");

                    //reset serviceName
                    serviceName = StringUtils.substringAfterLast(servicePart, ",");

                }
                i++;
            }
        }

        for (String service : StringUtils.split(finalServiceString, ",")) {
            String serviceName = service;
            map.put(serviceName, Arrays.asList(new String[] { ALL_COMPONENTS }));
        }
    }
    return map;
}

From source file:net.sf.gazpachoquest.domain.core.QuestionnaireAnswers.java

public Map<String, Object> getAnswers() {
    if (answers == null) {
        answers = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
    }//from   w  w w.j ava2  s.  com
    return answers;
}

From source file:net.sourceforge.pmd.lang.apex.ast.ASTAnnotation.java

public boolean suppresses(Rule rule) {
    final String ruleAnno = "PMD." + rule.getName();

    if (hasImageEqualTo("SuppressWarnings")) {
        for (ASTAnnotationParameter param : findChildrenOfType(ASTAnnotationParameter.class)) {
            String image = param.getImage();

            if (image != null) {
                Set<String> paramValues = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
                paramValues.addAll(Arrays.asList(image.replaceAll("\\s+", "").split(",")));
                if (paramValues.contains("PMD") || paramValues.contains(ruleAnno)
                        || paramValues.contains("all")) {
                    return true;
                }//from w ww.  j  a v  a  2s. c  o  m
            }
        }
    }

    return false;
}

From source file:com.evolveum.midpoint.schema.xjc.schema.FieldBox.java

@Override
public int compareTo(FieldBox fieldBox) {
    return String.CASE_INSENSITIVE_ORDER.compare(getFieldName(), fieldBox.getFieldName());
}

From source file:com.evolveum.midpoint.web.component.wizard.resource.dto.ConnectorHostTypeComparator.java

@Override
public int compare(PrismObject<ConnectorHostType> host1, PrismObject<ConnectorHostType> host2) {
    return String.CASE_INSENSITIVE_ORDER.compare(getUserFriendlyName(host1), getUserFriendlyName(host2));
}

From source file:com.michellemay.mappings.LanguageTagsMapping.java

/**
 * Instantiates a new Language tags mapping.
 *//* w  ww .  jav a2 s  .  c o  m*/
public LanguageTagsMapping() {
    super(NAME);
    this.withCaseSensitive(false);

    // Build reverse map.  Use a tree map to offer case insensitiveness while preserving keys case (useful for extending)
    TreeMap<String, Locale> map = new TreeMap<String, Locale>(
            this.getCaseSensitive() ? null : String.CASE_INSENSITIVE_ORDER);
    for (Locale loc : LocaleUtils.availableLocaleList()) {
        String isoCode = loc.getLanguage();
        if (isoCode.length() > 0) {
            String displayValue = loc.toLanguageTag();
            if (!map.containsKey(displayValue)) {
                // Also add variant with underscores
                map.put(displayValue, loc);
                map.put(displayValue.replace('-', '_'), loc);
            }
        }
    }
    this.withMapping(map);
}