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:com.unboundid.scim2.common.messages.ListResponse.java

/**
 * Create a new List Response./*  w  w w  .  ja v  a2  s .c om*/
 *
 * @param props  Properties to construct the List Response.
 */
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
@SuppressWarnings("unchecked")
public ListResponse(final Map<String, Object> props) {
    final Map<String, Object> properties = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
    properties.putAll(props);

    checkRequiredProperties(properties, new String[] { "totalResults", "resources" });

    this.totalResults = (Integer) properties.get("totalResults");
    this.resources = (List<T>) properties.get("resources");
    this.startIndex = properties.containsKey("startIndex") ? (Integer) properties.get("startIndex") : null;
    this.itemsPerPage = properties.containsKey("itemsPerPage") ? (Integer) properties.get("itemsPerPage")
            : null;
    if (properties.containsKey("schemas")) {
        this.setSchemaUrns((Collection<String>) properties.get("schemas"));
    }
}

From source file:com.goncalomb.bukkit.nbteditor.commands.CommandBOS.java

static List<String> findBosVars(Player player, String prefix) {
    ItemStack item = player.getItemInHand();
    if (BookOfSouls.isValidBook(item)) {
        BookOfSouls bos = BookOfSouls.getFromBook(item);
        if (bos != null) {
            List<String> names = new ArrayList<String>();
            for (NBTVariableContainer container : bos.getEntityNBT().getAllVariables()) {
                for (String name : container.getVarNames()) {
                    if (StringUtil.startsWithIgnoreCase(name, prefix)) {
                        names.add(name);
                    }/*ww w  .  j a  va2 s  .  com*/
                }
            }
            Collections.sort(names, String.CASE_INSENSITIVE_ORDER);
            return names;
        }
    }
    return null;
}

From source file:org.thelq.stackexchange.dbimport.Controller.java

public void initMetadataMap(SessionFactory sessionFactory) {
    ImmutableSortedMap.Builder<String, ImmutableMap<String, Type>> metadataMapBuilder = ImmutableSortedMap
            .orderedBy(String.CASE_INSENSITIVE_ORDER);
    for (Map.Entry<String, ClassMetadata> curEntry : sessionFactory.getAllClassMetadata().entrySet()) {
        ClassMetadata tableDataRaw = curEntry.getValue();
        ImmutableMap.Builder<String, Type> propertiesBuilder = ImmutableMap.builder();
        propertiesBuilder.put(tableDataRaw.getIdentifierPropertyName(), tableDataRaw.getIdentifierType());
        for (String curPropertyName : tableDataRaw.getPropertyNames())
            propertiesBuilder.put(curPropertyName, tableDataRaw.getPropertyType(curPropertyName));
        metadataMapBuilder.put(curEntry.getKey(), propertiesBuilder.build());
    }//from  w  ww .  j a va2  s  . co  m
    metadataMap = metadataMapBuilder.build();
}

From source file:org.connid.bundles.soap.cxf.ForceSoapActionOutInterceptor.java

private void setSoapAction(SoapMessage message) {
    BindingOperationInfo boi = message.getExchange().getBindingOperationInfo();

    // The soap action is set on the wrapped operation.
    if (boi != null && boi.isUnwrapped()) {
        boi = boi.getWrappedOperation();
    }//from  w  w  w .  ja  va  2  s .c  om

    String action = getSoapAction(message, boi);

    if (message.getVersion() instanceof Soap11) {
        Map<String, List<String>> reqHeaders = CastUtils
                .cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS));
        if (reqHeaders == null) {
            reqHeaders = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
        }

        if (reqHeaders.size() == 0) {
            message.put(Message.PROTOCOL_HEADERS, reqHeaders);
        }

        if (!reqHeaders.containsKey(SoapBindingConstants.SOAP_ACTION)) {
            reqHeaders.put(SoapBindingConstants.SOAP_ACTION, Collections.singletonList(action));
        }
    } else if (message.getVersion() instanceof Soap12 && !"\"\"".equals(action)) {
        String ct = (String) message.get(Message.CONTENT_TYPE);

        if (ct.indexOf("action=\"") == -1) {
            ct = new StringBuilder().append(ct).append("; action=").append(action).toString();
            message.put(Message.CONTENT_TYPE, ct);
        }
    }
}

From source file:com.acceleratedio.pac_n_zoom.FindTagsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_find_tags);
    req_str = getIntent().getExtras().getString("requestString");
    fil_tags = getIntent().getExtras().getString("tagString").split("(\\s*,\\s*)|(\\s* \\s*)");
    Arrays.sort(fil_tags, String.CASE_INSENSITIVE_ORDER);
    dsply_tags();// w  w w. ja v  a  2s  .co  m
    tgTxtBar = (EditText) findViewById(R.id.ed_tgs);
    tgTxtBar.setOnClickListener(this);

    tgTxtBar.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence key_sqnc, int start, int before, int count) {

            final StringBuilder strBldr = new StringBuilder(key_sqnc.length());
            strBldr.append(key_sqnc);
            srch_str = strBldr.toString();
            dsply_tags();
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
}

From source file:com.senior.fragments.GoogleFragment.java

@Override
public View onCreateView(LayoutInflater inflate, ViewGroup container, Bundle savedInstanceState) {
    Log.i("Google", "Oncreate view called");

    map = inflate.inflate(R.layout.google_fragment, container, false);
    buildingList = (Spinner) map.findViewById(R.id.buildings);

    buildingNames.clear();/*from  ww w .jav  a  2 s  .  c  o m*/
    buildingCoord.clear();

    //Adds and organizes the buildings alphabetically
    buildingNames.addAll(Arrays.asList(getResources().getStringArray(R.array.listOfBuildings)));
    Collections.sort(buildingNames, String.CASE_INSENSITIVE_ORDER);

    buildingCoord.addAll(Arrays.asList(getResources().getStringArray(R.array.listOfBuildings)));
    Collections.sort(buildingCoord, String.CASE_INSENSITIVE_ORDER);

    for (int index = 0; index < buildingNames.size(); index++) {
        buildingNames.set(index, buildingNames.get(index).substring(0, buildingNames.get(index).indexOf(',')));
    }

    buildingNames.add(0, "Select one");

    ArrayAdapter<String> array = new ArrayAdapter<String>(getActivity(),
            android.R.layout.simple_dropdown_item_1line, buildingNames);
    buildingList.setAdapter(array);

    //Places point on building when building is selected
    buildingList.setOnItemSelectedListener(new OnItemSelectedListener() {
        private double lat = 0;
        private double lon = 0;
        private String latString;
        private String longString;

        @Override
        public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

            if (TAMUK != null && arg2 != 0) {
                navigate = 0;

                latString = buildingCoord.get(arg2 - 1);
                latString = latString.substring(latString.indexOf(',') + 1, latString.lastIndexOf(','));

                longString = buildingCoord.get(arg2 - 1);
                longString = longString.substring(longString.lastIndexOf(',') + 1);

                lat = Double.parseDouble(latString);
                lon = Double.parseDouble(longString);

                TAMUK.clear();
                TAMUK.addMarker(new MarkerOptions().position(new LatLng(lat, lon))
                        .title(buildingNames.get(arg2)).snippet("Touch marker twice to start navigation"));
                TAMUK.setOnMarkerClickListener(new OnMarkerClickListener() {
                    @Override
                    public boolean onMarkerClick(Marker marker) {
                        navigate++;

                        if (navigate == 2) {
                            navigate = 0;
                            String url = "http://maps.google.com/maps?f=d&daddr=" + lat + "," + lon
                                    + "&dirflg=d";
                            Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
                            intent.setClassName("com.google.android.apps.maps",
                                    "com.google.android.maps.MapsActivity");
                            startActivity(intent);
                        }
                        return false;
                    }
                });
                TAMUK.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lon), 17));
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {

        }

    });

    setUpMap();

    return map;
}

From source file:org.kuali.rice.kns.util.BeanPropertyComparator.java

/**
 * Constructs a PropertyComparator for comparing beans using the properties named in the given List. Properties will be compared
 * in the order in which they are listed. Case will be ignored if ignoreCase is true.
 * //  ww w .  jav  a 2 s .  c o  m
 * @param propertyNames List of property names (as Strings) used to compare beans
 * @param ignoreCase if true, case will be ignored during String comparisons
 */
public BeanPropertyComparator(List propertyNames, boolean ignoreCase) {
    if (propertyNames == null) {
        throw new IllegalArgumentException("invalid (null) propertyNames list");
    }
    if (propertyNames.size() == 0) {
        throw new IllegalArgumentException("invalid (empty) propertyNames list");
    }
    this.propertyNames = Collections.unmodifiableList(propertyNames);
    this.ignoreCase = ignoreCase;

    if (ignoreCase) {
        this.stringComparator = String.CASE_INSENSITIVE_ORDER;
    } else {
        this.stringComparator = ComparableComparator.getInstance();
    }
    this.booleanComparator = new Comparator() {
        public int compare(Object o1, Object o2) {
            int compared = 0;

            Boolean b1 = (Boolean) o1;
            Boolean b2 = (Boolean) o2;

            if (!b1.equals(b2)) {
                if (b1.equals(Boolean.FALSE)) {
                    compared = -1;
                } else {
                    compared = 1;
                }
            }

            return compared;
        }

    };
    this.genericComparator = ComparableComparator.getInstance();
}

From source file:org.apereo.services.persondir.support.ldap.AttributeMapAttributesMapper.java

/**
 * Create a Map instance to be used as attribute map.
 * <br>/*from   w  ww. j  ava  2s. co m*/
 * By default, a linked case-insensitive Map will be created
 *
 * @param attributeCount the attribute count, to be used as initial capacity for the Map
 * @return the new Map instance
 */
@SuppressWarnings("unchecked")
protected Map<String, Object> createAttributeMap(final int attributeCount) {
    return new TreeMap(String.CASE_INSENSITIVE_ORDER);
}

From source file:edu.wisc.doit.tcrypt.controller.EncryptController.java

@RequestMapping(value = "/encryptionServices", method = RequestMethod.GET)
public @ResponseBody Set<String> getServiceNamesInJSON() {
    final TreeSet<String> serviceNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
    serviceNames.addAll(keysKeeper.getListOfServiceNames());
    return serviceNames;
}

From source file:uk.org.rbc1b.roms.db.common.MergeUtilTest.java

@Test
public void testMergeRightEmpty() {
    final List<Pair<String, String>> outputs = new ArrayList<Pair<String, String>>();

    MergeUtil.merge(Arrays.asList("foo"), Collections.<String>emptyList(), String.CASE_INSENSITIVE_ORDER,
            new MergeUtil.Callback<String, String>() {
                @Override/*from ww w .j  ava 2 s . c  o m*/
                public void output(String leftValue, String rightValue) {
                    outputs.add(new ImmutablePair<String, String>(leftValue, rightValue));
                }
            });

    assertEquals(Arrays.asList(new ImmutablePair<String, String>("foo", null)), outputs);
}