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:Main.java

private DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) {
    String curPath = dir.getPath();
    DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(curPath);
    if (curTop != null) {
        curTop.add(curDir);//from  w w  w . ja  v  a2  s .c o m
    }
    Vector<String> ol = new Vector<String>();
    String[] tmp = dir.list();
    for (int i = 0; i < tmp.length; i++) {
        ol.addElement(tmp[i]);
    }
    Collections.sort(ol, String.CASE_INSENSITIVE_ORDER);
    File f;
    Vector<Object> files = new Vector<Object>();
    for (int i = 0; i < ol.size(); i++) {
        String thisObject = ol.elementAt(i);
        String newPath;
        if (curPath.equals(".")) {
            newPath = thisObject;
        } else {
            newPath = curPath + File.separator + thisObject;
        }
        if ((f = new File(newPath)).isDirectory()) {
            addNodes(curDir, f);
        } else {
            files.addElement(thisObject);
        }
    }
    for (int fnum = 0; fnum < files.size(); fnum++) {
        curDir.add(new DefaultMutableTreeNode(files.elementAt(fnum)));
    }
    return curDir;
}

From source file:forge.download.GuiDownloadPicturesLQ.java

@Override
protected final Map<String, String> getNeededFiles() {
    final Map<String, String> downloads = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);

    for (final PaperCard c : FModel.getMagicDb().getCommonCards().getAllCards()) {
        addDLObject(c, downloads, false);
        if (ImageUtil.hasBackFacePicture(c)) {
            addDLObject(c, downloads, true);
        }/*  w  w  w  .j  a  v a2 s  .  co  m*/
    }

    for (final PaperCard c : FModel.getMagicDb().getVariantCards().getAllCards()) {
        addDLObject(c, downloads, false);
    }

    // Add missing tokens to the list of things to download.
    addMissingItems(downloads, ForgeConstants.IMAGE_LIST_TOKENS_FILE, ForgeConstants.CACHE_TOKEN_PICS_DIR);

    return downloads;
}

From source file:forge.download.GuiDownloadSetPicturesLQ.java

@Override
protected final Map<String, String> getNeededFiles() {
    final Map<String, String> downloads = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);

    for (final PaperCard c : Iterables.concat(FModel.getMagicDb().getCommonCards().getAllCards(),
            FModel.getMagicDb().getVariantCards().getAllCards())) {
        final String setCode3 = c.getEdition();
        if (StringUtils.isBlank(setCode3) || CardEdition.UNKNOWN.getCode().equals(setCode3)) {
            // we don't want cards from unknown sets
            continue;
        }// w ww.j av a  2  s .  c o  m
        addDLObject(ImageUtil.getDownloadUrl(c, false), ImageUtil.getImageKey(c, false, true), downloads);

        if (ImageUtil.hasBackFacePicture(c)) {
            addDLObject(ImageUtil.getDownloadUrl(c, true), ImageUtil.getImageKey(c, true, true), downloads);
        }
    }

    // Add missing tokens to the list of things to download.
    addMissingItems(downloads, ForgeConstants.IMAGE_LIST_TOKENS_FILE, ForgeConstants.CACHE_TOKEN_PICS_DIR);

    return downloads;
}

From source file:forge.util.FileSection.java

public static Map<String, String> parseToMap(final String line, final String kvSeparator,
        final String pairSeparator) {
    Map<String, String> result = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    if (!StringUtils.isEmpty(line)) {
        final String[] pairs = line.split(Pattern.quote(pairSeparator));
        final Pattern splitter = Pattern.compile(Pattern.quote(kvSeparator));

        for (final String dd : pairs) {
            final String[] v = splitter.split(dd, 2);
            result.put(v[0].trim(), v.length > 1 ? v[1].trim() : "");
        }/*from  w  ww  . jav a  2 s  . c  o m*/
    }
    return result;
}

From source file:com.netflix.genie.core.jpa.specifications.JpaSpecificationUtils.java

/**
 * Get the sorted like statement for tags used in specification queries.
 *
 * @param tags The tags to use. Not null.
 * @return The tags sorted while ignoring case delimited with percent symbol.
 *//*from ww w  . j  a  v a 2  s  .  c o  m*/
public static String getTagLikeString(@NotNull final Set<String> tags) {
    final StringBuilder builder = new StringBuilder();
    tags.stream().filter(StringUtils::isNotBlank).sorted(String.CASE_INSENSITIVE_ORDER)
            .forEach(tag -> builder.append(PERCENT).append(CommonFieldsEntity.TAG_DELIMITER).append(tag)
                    .append(CommonFieldsEntity.TAG_DELIMITER));
    return builder.append(PERCENT).toString();
}

From source file:org.kuali.kra.common.notification.lookup.keyvalue.KeyLabelSortByValue.java

@Override
public int compareTo(KeyLabelPair o) {
    if (o == null) {
        throw new NullPointerException("the object to compare to is null");
    }//w w  w.  jav  a  2  s . c o m
    CompareToBuilder builder = new CompareToBuilder();
    builder.append(this.label, o.label, String.CASE_INSENSITIVE_ORDER);

    if ((this.key instanceof String) && (o.key instanceof String))
        builder.append(this.key, o.key, String.CASE_INSENSITIVE_ORDER);
    else {
        builder.append(this.key, o.key);
    }

    builder.append(this.numPaddedSpaces, o.numPaddedSpaces);
    return builder.toComparison();

}

From source file:com.kpb.other.AcmeCorpPhysicalNamingStrategy.java

private static Map<String, String> buildAbbreviationMap() {
    TreeMap<String, String> abbreviationMap = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    abbreviationMap.put("account", "acct");
    abbreviationMap.put("number", "num");
    return abbreviationMap;
}

From source file:portal.api.util.HeadersOutInterceptor.java

@Override
public void handleMessage(Message outMessage) throws Fault {

    Map<String, List<String>> headers = (Map<String, List<String>>) outMessage.get(Message.PROTOCOL_HEADERS);

    if (headers == null) {
        headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);

        List<String> vl = new ArrayList<String>();
        vl.add("1.0.0");
        headers.put("X-Portal-API-Version", vl);
        //         vl = new ArrayList<String>();
        //         vl.add("*");
        //         headers.put("Access-Control-Allow-Origin", vl);         
        outMessage.put(Message.PROTOCOL_HEADERS, headers);
    }//  w w  w. ja v a 2s.  c o  m

    // modify headers

}

From source file:eu.forgestore.ws.util.HeadersOutInterceptor.java

@Override
public void handleMessage(Message outMessage) throws Fault {

    Map<String, List<String>> headers = (Map<String, List<String>>) outMessage.get(Message.PROTOCOL_HEADERS);

    if (headers == null) {
        headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);

        List<String> vl = new ArrayList<String>();
        vl.add("1.0.0");
        headers.put("X-Baker-API-Version", vl);
        //         vl = new ArrayList<String>();
        //         vl.add("*");
        //         headers.put("Access-Control-Allow-Origin", vl);         
        outMessage.put(Message.PROTOCOL_HEADERS, headers);
    }//ww w . ja  v a2  s.c om

    // modify headers

}

From source file:org.ligoj.app.plugin.prov.aws.auth.AWS4SignerBase.java

/**
 * Returns the canonical collection of header names that will be included in the signature. For AWS4, all header
 * names must be included in the process in sorted canonicalized order.
 * //from   w w  w.  j  a va  2 s.  c o  m
 * @param headers
 *            Current headers.
 * @return Appended headers names only.
 */
protected String getCanonicalizeHeaderNames(final Map<String, String> headers) {
    return headers.keySet().stream().sorted(String.CASE_INSENSITIVE_ORDER).map(String::toLowerCase)
            .collect(Collectors.joining(";"));
}