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:org.opens.tgol.presentation.factory.TestResultFactory.java
/** * This method sorts the processResult elements * @param processResultList// ww w.j a v a 2 s . c om */ private void sortCollection(List<? extends ProcessResult> processResultList) { Collections.sort(processResultList, new Comparator<ProcessResult>() { @Override public int compare(ProcessResult o1, ProcessResult o2) { return String.CASE_INSENSITIVE_ORDER.compare(o1.getTest().getCode(), o2.getTest().getCode()); } }); }
From source file:com.evolveum.midpoint.web.component.wizard.resource.NameStep.java
private List<PrismObject<ConnectorType>> loadConnectorTypes(PrismObject<ConnectorHostType> host) { List<PrismObject<ConnectorType>> filtered = filterConnectorTypes(host, null); Collections.sort(filtered, new Comparator<PrismObject<ConnectorType>>() { @Override//from ww w . j a va 2 s .c om public int compare(PrismObject<ConnectorType> c1, PrismObject<ConnectorType> c2) { String name1 = c1.getPropertyRealValue(ConnectorType.F_CONNECTOR_TYPE, String.class); String name2 = c2.getPropertyRealValue(ConnectorType.F_CONNECTOR_TYPE, String.class); return String.CASE_INSENSITIVE_ORDER.compare(name1, name2); } }); return filtered; }
From source file:com.github.hexosse.pluginframework.pluginapi.PluginCommand.java
/** * Requests a list of possible completions for a command argument. * Override this method in your command/*from w ww . j a va 2 s . com*/ * * @param commandInfo Info about the command * * @return A List of possible completions for the final argument, or null * to default to the command executor */ public List<String> onTabComplete(CommandInfo commandInfo) { List<String> completions = Lists.newArrayList(); if (commandInfo.numArgs() == 0) { for (Map.Entry<String, PluginCommand<?>> entry : this.subCommands.entrySet()) { String commandName = entry.getKey(); completions.add(commandName); } if (this.arguments.size() > 0) completions = this.arguments.get(0).getType().tabComplete(commandInfo); } else { for (Map.Entry<String, PluginCommand<?>> entry : this.subCommands.entrySet()) { if (entry.getKey().toLowerCase().startsWith(commandInfo.getLastArg().toLowerCase())) { String commandName = entry.getKey(); completions.add(commandName); } } if (this.arguments.size() >= commandInfo.numArgs()) completions = this.arguments.get(commandInfo.numArgs() - 1).getType().tabComplete(commandInfo); } if (completions != null && completions.size() > 0) Collections.sort(completions, String.CASE_INSENSITIVE_ORDER); return completions; }
From source file:com.ultramegasoft.flavordex2.dialog.FileSelectorDialog.java
/** * Get the list of files in the given path that match the current name filter. * * @param path The path to a directory to list files from * @return An array of file names// w ww. ja v a2 s . c o m */ @NonNull private String[] getFileList(@NonNull File path) { final FilenameFilter filenameFilter = new FilenameFilter() { public boolean accept(File dir, String filename) { final File file = new File(dir, filename); return !(!file.canRead() || file.isDirectory() || filename.startsWith(".")) && matchesFilter(filename); } }; final String[] fileList = path.list(filenameFilter); if (fileList == null) { return new String[0]; } Arrays.sort(fileList, String.CASE_INSENSITIVE_ORDER); return fileList; }
From source file:com.ebay.erl.mobius.core.model.TupleColumnComparator.java
private TreeMap<String, Integer> getIdxMapping(Sorter[] sorters) { // the ordering of the values of the columns in k1 and k2 // are sorted by the column name's alphabetic ordering, // see {@link Tuple#write}. We might not have the schema // of the tuple here, so we need to build the index according // to the selected columns from the sorters in alphabetic order, // then we can get the value directly using index. if (_IDX_MAPPING == null) { _IDX_MAPPING = new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER); List<String> columnNames = new ArrayList<String>(); for (Sorter aSorter : sorters) { columnNames.add(aSorter.getColumn().toLowerCase()); }/*from w w w . j a v a 2 s . co m*/ Collections.sort(columnNames); for (int i = 0; i < columnNames.size(); i++) { _IDX_MAPPING.put(columnNames.get(i), i); } } return _IDX_MAPPING; }
From source file:org.apache.syncope.core.util.ImportExport.java
private List<String> sortByForeignKeys(final Connection conn, final Set<String> tableNames, final String schema) throws SQLException { Set<MultiParentNode<String>> roots = new HashSet<MultiParentNode<String>>(); final DatabaseMetaData meta = conn.getMetaData(); final Map<String, MultiParentNode<String>> exploited = new TreeMap<String, MultiParentNode<String>>( String.CASE_INSENSITIVE_ORDER); final Set<String> pkTableNames = new HashSet<String>(); for (String tableName : tableNames) { MultiParentNode<String> node = exploited.get(tableName); if (node == null) { node = new MultiParentNode<String>(tableName); roots.add(node);/*from w w w . j av a2s.c o m*/ exploited.put(tableName, node); } ResultSet rs = null; pkTableNames.clear(); try { rs = meta.getImportedKeys(conn.getCatalog(), readSchema(), tableName); // this is to avoid repetition while (rs.next()) { pkTableNames.add(rs.getString("PKTABLE_NAME")); } } finally { if (rs != null) { try { rs.close(); } catch (SQLException e) { LOG.error("While closing tables result set", e); } } } for (String pkTableName : pkTableNames) { if (!tableName.equalsIgnoreCase(pkTableName)) { MultiParentNode<String> pkNode = exploited.get(pkTableName); if (pkNode == null) { pkNode = new MultiParentNode<String>(pkTableName); roots.add(pkNode); exploited.put(pkTableName, pkNode); } pkNode.addChild(node); if (roots.contains(node)) { roots.remove(node); } } } } final List<String> sortedTableNames = new ArrayList<String>(tableNames.size()); MultiParentNodeOp.traverseTree(roots, sortedTableNames); Collections.reverse(sortedTableNames); return sortedTableNames; }
From source file:com.qatickets.domain.Ticket.java
public String getComponentsAsString() { if (components == null) { return null; }/*from w ww. j a va 2 s .co m*/ List<String> list = new ArrayList<String>(components.size()); for (TicketComponent c : components) { list.add(Integer.toString(c.getComponent().getId())); } Collections.sort(list, String.CASE_INSENSITIVE_ORDER); return StringUtils.join(list, ","); }
From source file:org.springframework.jdbc.repo.impl.jdbc.RawPropertiesRepoImpl.java
@Override @Transactional(readOnly = true)/* w ww. ja v a2 s . c o m*/ public List<String> listMatchingIdentifiers(final String pattern) { if (StringUtils.isEmpty(pattern)) { return Collections.emptyList(); } return jdbcAccessor.query( "SELECT " + ENTITY_ID_COL + " FROM " + IDENTIFIED_ENTITIES_TABLE + " WHERE " + ENTITY_TYPE_COL + " =:" + ENTITY_TYPE_COL + " AND " + ENTITY_ID_COL + " LIKE :" + ENTITY_ID_COL, new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER) { private static final long serialVersionUID = 1L; { put(ENTITY_TYPE_COL, getEntityClass().getSimpleName()); put(ENTITY_ID_COL, pattern.replace('*', '%')); } }, JdbcOperationsUtils.AS_STRING_MAPPER); }
From source file:org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardOps.java
private SortedMap<String, Integer> getRepositories(String url) throws IOException, JAXBException, ParseException { ReviewboardConnection con = ReviewboardConnection.fromConfiguration(); ensureAuthentication(con, http);/*from w ww .j a va 2s . c o m*/ Response response = getResponse(http, url, Response.class); SortedMap<String, Integer> map = new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER); if (response.count > 0) { for (Item i : response.repositories.array) { map.put(i.name, i.id); } if (response.links.next != null) { map.putAll(getRepositories(response.links.next.href)); } } return map; }
From source file:com.amazon.dtasdk.v2.signature.Signer.java
protected List<String> getSortedHeaders(Request request) { List<String> sortedHeaders = new ArrayList<String>(request.getHeaderNames()); Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER); return sortedHeaders; }