List of usage examples for java.lang String compareToIgnoreCase
public int compareToIgnoreCase(String str)
From source file:pl.otros.logview.filter.ThreadFilter.java
private void reloadThreads() { LogData[] ld = collector.getLogData(); TreeSet<String> sortedThreads = new TreeSet<String>(new Comparator<String>() { @Override// w ww . j a v a 2 s . co m public int compare(String arg0, String arg1) { return arg0.compareToIgnoreCase(arg1); } }); for (LogData logData : ld) { sortedThreads.add(logData.getThread()); } for (String sortedThread : sortedThreads) { if (!listModel.contains(sortedThread)) { listModel.add(listModel.getSize(), sortedThread); } } setThreadToFilter(selectedThread.toArray(new String[selectedThread.size()])); }
From source file:jetbrains.buildServer.clouds.vmware.web.VMWareEditProfileController.java
private List<String> getIgnoreCaseSortedList(Collection<String> src) { final List<String> sortedList = new ArrayList<String>(src); Collections.sort(sortedList, new Comparator<String>() { public int compare(final String o1, final String o2) { return o1.compareToIgnoreCase(o2); }//from w w w . j a v a 2 s . c om }); return sortedList; }
From source file:io.watchcat.node.monitoring.DiskMonitor.java
@Override public void run() { try {/*from w w w. j av a 2 s. c o m*/ DiskUsage diskUsage = metricsCollector.getDiskUsage(); List<Disk> disks = diskUsage.getDisks(); Iterator<Disk> iterator = disks.iterator(); while (iterator.hasNext()) { Disk disk = iterator.next(); String key = disk.getDisk(); if (key.compareToIgnoreCase("none") == 0) { continue; } CriticalityEvent existingEvent = diskUsageEvents.get(key); if (disk.getPercentageUsed() >= diskThresholds.getCriticalThreshold()) { if (existingEvent == null) { beginEvent(key, Criticality.CRITICAL, disk.getPercentageUsed()); } else { existingEvent.updateStatus(Criticality.CRITICAL, String.valueOf(disk.getPercentageUsed())); } } else if (disk.getPercentageUsed() >= diskThresholds.getMajorThreshold()) { if (existingEvent == null) { beginEvent(key, Criticality.MAJOR, disk.getPercentageUsed()); } else { existingEvent.updateStatus(Criticality.MAJOR, String.valueOf(disk.getPercentageUsed())); } } else if (disk.getPercentageUsed() >= diskThresholds.getMinorThreshold()) { if (existingEvent == null) { beginEvent(key, Criticality.MINOR, disk.getPercentageUsed()); } else { existingEvent.updateStatus(Criticality.MINOR, String.valueOf(disk.getPercentageUsed())); } } else { if (existingEvent != null) { existingEvent.end(); diskUsageEvents.remove(key); } } } } catch (Exception e) { e.printStackTrace(); } scheduledExecutorService.schedule(this, 5, TimeUnit.SECONDS); }
From source file:org.parosproxy.paros.core.scanner.plugin.TestInfoGatheringSessionIdURL.java
private void checkSessionIDExposure(HttpMessage msg) throws URIException { String body = msg.getResponseBody().toString(); int risk = (msg.getRequestHeader().getSecure()) ? Alert.RISK_MEDIUM : Alert.RISK_INFO; String linkHostName = null;/*from www . j av a 2 s .co m*/ Matcher matcher = null; for (int i = 0; i < staticLinkCheck.length; i++) { matcher = staticLinkCheck[i].matcher(body); while (matcher.find()) { linkHostName = matcher.group(1); String host = msg.getRequestHeader().getURI().getHost(); if (host.compareToIgnoreCase(linkHostName) != 0) { bingo(risk, Alert.WARNING, alertReferer, descReferer, null, null, linkHostName, solutionReferer, msg); } } } }
From source file:org.openmrs.module.laboratory.web.ajax.AjaxController.java
/** * Concept search autocomplete for form//from w w w . j a v a2 s . c om * * @param name * @param model * @return */ @SuppressWarnings("deprecation") @RequestMapping(value = "/module/laboratory/ajax/autocompleteConceptSearch.htm", method = RequestMethod.GET) public String autocompleteConceptSearch(@RequestParam(value = "q", required = false) String name, Model model) { List<ConceptWord> cws = Context.getConceptService().findConcepts(name, new Locale("en"), false); Set<String> conceptNames = new HashSet<String>(); for (ConceptWord word : cws) { String conceptName = word.getConcept().getName().getName(); conceptNames.add(conceptName); } List<String> concepts = new ArrayList<String>(); concepts.addAll(conceptNames); Collections.sort(concepts, new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); model.addAttribute("conceptNames", concepts); return "/module/laboratory/ajax/autocompleteConceptSearch"; }
From source file:com.andrew.apollo.menu.CreateNewPlaylist.java
private String makePlaylistName() { final String template = getString(R.string.new_playlist_name_template); int num = 1;//from w w w. j a v a 2 s . c om final String[] projection = new String[] { MediaStore.Audio.Playlists.NAME }; final ContentResolver resolver = getActivity().getContentResolver(); final String selection = MediaStore.Audio.Playlists.NAME + " != ''"; Cursor cursor = resolver.query(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, projection, selection, null, MediaStore.Audio.Playlists.NAME); if (cursor == null) { return null; } String suggestedName; suggestedName = String.format(template, num++); boolean done = false; while (!done) { done = true; cursor.moveToFirst(); while (!cursor.isAfterLast()) { final String playlistName = cursor.getString(0); if (playlistName.compareToIgnoreCase(suggestedName) == 0) { suggestedName = String.format(template, num++); done = false; } cursor.moveToNext(); } } cursor.close(); return suggestedName; }
From source file:org.talend.commons.utils.data.sort.MultiplePropertiesBeanComparator.java
private int compareStrings(String string1, String string2) { if (this.ignoreCase) { return string1.compareToIgnoreCase(string2); } else {//from www. j a v a 2 s.c om return string1.compareTo(string2); } }
From source file:org.onesun.atomator.adaptors.LinkedInAdaptor.java
private Feed parseDocument(Document document) { Factory abderaFactory = AbderaUtils.getAbderaFactory(); Feed feed = abderaFactory.newFeed(); Element element = document.getDocumentElement(); // Entry from LinkedIn is tagged as "update" NodeList updates = element.getElementsByTagName("update"); if (updates != null && updates.getLength() > 0) { for (int index = 0; index < updates.getLength(); index++) { Element item = (Element) updates.item(index); // Interested only in status updates String updateType = XMLUtils.getValue(item, "update-type"); if (updateType != null && (updateType.compareToIgnoreCase("STAT") == 0)) { Entry entry = toEntry(item); if (entry != null) { // DO NOT ADD FEEDS THAT HAVE NO TITLE - all updates must be upconverted // TODO: Check method "toEntry" String title = entry.getTitle(); if ((title != null) && ((StringUtils.trim(title)).length() > 0)) { feed.addEntry(entry); }/*from w ww .j av a2s. c o m*/ } } } } if (feed != null && feed.getEntries().size() > 0) { return feed; } else { return null; } }
From source file:SortTreeDemo.java
public int compare(Object o1, Object o2) { if (!(o1 instanceof DefaultMutableTreeNode && o2 instanceof DefaultMutableTreeNode)) { throw new IllegalArgumentException("Can only compare DefaultMutableTreeNode objects"); }//from w w w .j av a 2s . co m String s1 = ((DefaultMutableTreeNode) o1).getUserObject().toString(); String s2 = ((DefaultMutableTreeNode) o2).getUserObject().toString(); return s1.compareToIgnoreCase(s2); }
From source file:org.openmrs.module.radiology.web.ajax.AjaxController.java
/** * Concept search autocomplete for form/*from ww w . ja v a2 s . c o m*/ * * @param name * @param model * @return */ @SuppressWarnings("deprecation") @RequestMapping(value = "/module/radiology/ajax/autocompleteConceptSearch.htm", method = RequestMethod.GET) public String autocompleteConceptSearch(@RequestParam(value = "q", required = false) String name, Model model) { List<ConceptWord> cws = Context.getConceptService().findConcepts(name, new Locale("en"), false); Set<String> conceptNames = new HashSet<String>(); for (ConceptWord word : cws) { String conceptName = word.getConcept().getName().getName(); conceptNames.add(conceptName); } List<String> concepts = new ArrayList<String>(); concepts.addAll(conceptNames); Collections.sort(concepts, new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); model.addAttribute("conceptNames", concepts); return "/module/radiology/ajax/autocompleteConceptSearch"; }