List of usage examples for java.lang String CASE_INSENSITIVE_ORDER
Comparator CASE_INSENSITIVE_ORDER
To view the source code for java.lang String CASE_INSENSITIVE_ORDER.
Click Source Link
From source file:com.macleod2486.fragment.Map.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.map, container, false); //Gets the building lists into an arraylist buildingList.clear();//www . ja va 2 s . c o m buildingList.addAll(Arrays.asList(getResources().getStringArray(R.array.fraternity))); buildingList.addAll(Arrays.asList(getResources().getStringArray(R.array.sorority))); buildingList.addAll(Arrays.asList(getResources().getStringArray(R.array.maincampus))); buildingList.addAll(Arrays.asList(getResources().getStringArray(R.array.intramuralfields))); buildingList.addAll(Arrays.asList(getResources().getStringArray(R.array.pickleresearchcampus))); buildingList.addAll(Arrays.asList(getResources().getStringArray(R.array.parkinggarages))); buildingList.addAll(Arrays.asList(getResources().getStringArray(R.array.residencehalls))); Collections.sort(buildingList, String.CASE_INSENSITIVE_ORDER); completeList.clear(); completeList.addAll(Arrays.asList(getResources().getStringArray(R.array.fraternity))); completeList.addAll(Arrays.asList(getResources().getStringArray(R.array.sorority))); completeList.addAll(Arrays.asList(getResources().getStringArray(R.array.maincampus))); completeList.addAll(Arrays.asList(getResources().getStringArray(R.array.pickleresearchcampus))); completeList.addAll(Arrays.asList(getResources().getStringArray(R.array.parkinggarages))); completeList.addAll(Arrays.asList(getResources().getStringArray(R.array.residencehalls))); Collections.sort(completeList, String.CASE_INSENSITIVE_ORDER); //Only puts the building name for the autocomplete text for (int index = 0; index < buildingList.size(); index++) { buildingList.set(index, buildingList.get(index).substring(0, buildingList.get(index).indexOf(','))); } search = (AutoCompleteTextView) view.findViewById(R.id.mapSearch); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_dropdown_item_1line, buildingList); search.setThreshold(1); search.setAdapter(adapter); search.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) { final Double lat; final Double lon; final String selection = (String) parent.getItemAtPosition(position); latitude = completeList.get(buildingList.indexOf(selection)); latitude = latitude.substring(latitude.indexOf(",") + 1, latitude.lastIndexOf(",")); longitude = completeList.get(buildingList.indexOf(selection)); longitude = longitude.substring(longitude.lastIndexOf(",") + 1); lat = Double.parseDouble(latitude); lon = Double.parseDouble(longitude); navigate = 0; final MarkerOptions markerOpt = new MarkerOptions(); markerOpt.position(new LatLng(lat, lon)).title(selection); markerOpt.snippet("Touch marker twice to navigate"); UT.clear(); UT.addMarker(markerOpt); UT.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lon), 17)); UT.setOnMarkerClickListener(new OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { Log.i("Map", "Marker clicked"); navigate++; //If the marker is clicked twice it launches navigation if (navigate == 2) { navigate = 0; String url = "http://maps.google.com/maps?f=d&daddr=" + latitude + "," + longitude + "&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; } }); imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(search.getWindowToken(), 0); } }); search.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { if (arg0.toString().isEmpty()) { clear.setVisibility(View.INVISIBLE); } } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { Log.i("Map", "Text changed"); clear.setVisibility(View.VISIBLE); } }); clear = (ImageButton) view.findViewById(R.id.clearButton); clear.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { search.setText(""); clear.setVisibility(View.INVISIBLE); } }); //Sets up the map setUpUT(); return view; }
From source file:FileTree.java
/** Add nodes from under "dir" into curTop. Highly recursive. */ DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) { String curPath = dir.getPath(); DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(curPath); if (curTop != null) { // should only be null at root curTop.add(curDir);// ww w . j a v a 2s .c om } Vector ol = new Vector(); 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 files = new Vector(); // Make two passes, one for Dirs and one for Files. This is #1. for (int i = 0; i < ol.size(); i++) { String thisObject = (String) 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); } // Pass two: for files. for (int fnum = 0; fnum < files.size(); fnum++) curDir.add(new DefaultMutableTreeNode(files.elementAt(fnum))); return curDir; }
From source file:com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.WorkspaceVersionTable.java
/** * Called unconditionlly during the base class ctor to allow this class a * chance to initialize prior to Load being called. *//*from w w w. j a v a 2 s.c o m*/ @Override protected void initialize() { server = new SparseTree<WorkspaceLocalItemPair>(ServerPath.PREFERRED_SEPARATOR_CHARACTER, String.CASE_INSENSITIVE_ORDER); local = new SparseTree<WorkspaceLocalItem>(File.separatorChar, String.CASE_INSENSITIVE_ORDER); removedItems = new ArrayList<WorkspaceLocalItem>(); }
From source file:org.caleydo.datadomain.pathway.manager.EPathwayDatabaseType.java
@Override public int compareTo(EPathwayDatabaseType o) { return Objects.compare(name, o.name, String.CASE_INSENSITIVE_ORDER); }
From source file:Main.java
private static ArrayList<ArrayList> sortObjectArrayListSimpleMaster(ArrayList listIn, String paramName) { ArrayList<ArrayList> answer = new ArrayList<ArrayList>(); ArrayList newList = new ArrayList(); ArrayList<Integer> indices = new ArrayList<Integer>(); try {/* w ww. j ava 2 s.c om*/ if (listIn.size() > 0) { Class<?> c = listIn.get(0).getClass(); Field f = c.getDeclaredField(paramName); f.setAccessible(true); Class<?> t = f.getType(); Double dd = new Double(14); Float ff = new Float(14); Integer ii = new Integer(14); Map sortedPos = new LinkedHashMap(); Map sortedNeg = new LinkedHashMap(); Map unsorted = new LinkedHashMap(); int indexCount = 0; long count = 0; if (t.isPrimitive()) { for (Object thisObj : listIn) { Object o = f.get(thisObj); double d = 0; if (t.getName().equals("char")) { d = (int) ((Character) o); } else if (t.isInstance(dd)) d = (Double) o; else if (t.isInstance(ff)) d = (Float) o; else if (t.isInstance(ii)) d = (Integer) o; else d = new Double(o.toString()); boolean isNegative = false; if (d < 0) { isNegative = true; d = Math.abs(d); } String format = "%1$30f"; String newKey = String.format(format, d); String format2 = "%1$20d"; String countString = String.format(format2, count); newKey += "-" + countString; if (isNegative) { sortedNeg.put(newKey, thisObj); } else { sortedPos.put(newKey, thisObj); } unsorted.put(thisObj, indexCount); count++; indexCount++; } TreeMap<String, Object> resultPos = new TreeMap(); resultPos.putAll(sortedPos); sortedPos = resultPos; TreeMap<String, Object> resultNeg = new TreeMap(); resultNeg.putAll(sortedNeg); sortedNeg = resultNeg; } else if (t.isInstance(paramName)) { // System.out.println("is a string with value " + o); for (Object thisObj : listIn) { String key = (String) (f.get(thisObj)); sortedPos.put(key + "-" + count, thisObj); unsorted.put(thisObj, indexCount); count++; indexCount++; } TreeMap<String, Object> result = new TreeMap(String.CASE_INSENSITIVE_ORDER); result.putAll(sortedPos); sortedPos = result; } Iterator itNeg = sortedNeg.entrySet().iterator(); while (itNeg.hasNext()) { Map.Entry pairs = (Map.Entry) itNeg.next(); newList.add(pairs.getValue()); itNeg.remove(); } Collections.reverse(newList); Iterator itPos = sortedPos.entrySet().iterator(); while (itPos.hasNext()) { Map.Entry pairs = (Map.Entry) itPos.next(); Object obj = pairs.getValue(); newList.add(obj); indices.add((Integer) unsorted.get(obj)); itPos.remove(); } } } catch (Exception e) { System.out .println("problem sorting list. listIn.size(): " + listIn.size() + " and param: " + paramName); answer.add(newList); answer.add(indices); return answer; } answer.add(newList); answer.add(indices); return answer; }
From source file:cn.vlabs.duckling.vwb.service.auth.permissions.PagePermission.java
/** * Creates a new PagePermission for a specified page name and set of * actions. Page should include a prepended wiki name followed by a colon (:). * If the wiki name is not supplied or starts with a colon, the page * refers to no wiki in particular, and will never imply any other * PagePermission./*from www . jav a2 s .com*/ * @param page the wiki page * @param actions the allowed actions for this page */ public PagePermission(String page, String actions) { super(page); // Parse wiki and page (which may include wiki name and page) // Strip out attachment separator; it is irrelevant. int pos = page.indexOf(ATTACHMENT_SEPARATOR); m_page = (pos == -1) ? page : page.substring(0, pos); // Parse actions String[] pageActions = StringUtils.split(actions.toLowerCase(), ACTION_SEPARATOR); Arrays.sort(pageActions, String.CASE_INSENSITIVE_ORDER); m_mask = createMask(actions); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < pageActions.length; i++) { buffer.append(pageActions[i]); if (i < (pageActions.length - 1)) { buffer.append(ACTION_SEPARATOR); } } m_actionString = buffer.toString(); }
From source file:org.carewebframework.shell.layout.LayoutService.java
/** * Returns a list of saved layouts.//from w ww . j a v a 2 s. c o m * * @param shared If true, return shared layouts; otherwise, return personal layouts. * @return List of saved layouts. */ @Override public List<String> getLayouts(boolean shared) { List<String> layouts = propertyService.getInstances(getPropertyName(shared), shared); Collections.sort(layouts, String.CASE_INSENSITIVE_ORDER); return layouts; }
From source file:org.usergrid.utils.MapUtils.java
/** * @param <A>//from w ww. j av a 2 s. c o m * @param <B> * @param <C> * @param <D> * @param map * @param ignore_case * @param a * @param b * @param c * @param d */ @SuppressWarnings("unchecked") public static <A, B, C, D> void addMapMapMapSet(Map<A, Map<B, Map<C, Set<D>>>> map, boolean ignore_case, A a, B b, C c, D d) { Map<B, Map<C, Set<D>>> map_b = map.get(a); if (map_b == null) { if (ignore_case && (b instanceof String)) { map_b = (Map<B, Map<C, Set<D>>>) new TreeMap<String, Map<C, Set<D>>>(String.CASE_INSENSITIVE_ORDER); } else { map_b = new LinkedHashMap<B, Map<C, Set<D>>>(); } map.put(a, map_b); } addMapMapSet(map_b, ignore_case, b, c, d); }
From source file:org.nanoframework.orm.jdbc.record.AbstractJdbcRecord.java
protected void initColumnNames() { final Collection<Field> fields = instance.fields(); if (Result.JDBC_JSTL_CASE_INSENSITIVE_ORDER) { columnMapper = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); fieldColumnMapper = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); } else {/*w w w .j av a2s . c o m*/ columnMapper = Maps.newTreeMap(); fieldColumnMapper = Maps.newTreeMap(); } fields.stream().filter(field -> field.isAnnotationPresent(Column.class)).forEach(field -> { final String columnName = field.getAnnotation(Column.class).value(); columnMapper.put(columnName, field); fieldColumnMapper.put(field.getName(), columnName); }); Assert.notEmpty(columnMapper, "Record[ " + this.entity.getName() + " ], @Column"); }
From source file:com.microsoft.alm.plugin.idea.common.ui.common.ServerContextTableModel.java
public void addServerContexts(final List<ServerContext> contexts) { // Remember selection final ServerContext selectedContext = getSelectedContext(); // Add the new rows to the existing list rows.addAll(contexts);/*from w w w. j a v a2 s . c om*/ // Sort the rows by the first column Collections.sort(rows, new Comparator<ServerContext>() { @Override public int compare(ServerContext c1, ServerContext c2) { final String name1 = getValueFor(c1, 0); final String name2 = getValueFor(c2, 0); return String.CASE_INSENSITIVE_ORDER.compare(name1, name2); } }); if (hasFilter()) { // re-apply the filter, this will fire its own event applyFilter(); } else { // Fire an event letting callers know super.fireTableDataChanged(); } // Attempt to restore the selection select(selectedContext); }