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:StrSortCase.java
/** Simple main program to test the sorting */ public static void main(String[] argv) { //+/*from w w w.j a va 2s . c o m*/ System.out.println("StrSort Demo Ignoring Case"); StrSortCase s = new StrSortCase(); s.load(); s.dump("Before"); Collections.sort(s.v, String.CASE_INSENSITIVE_ORDER); s.dump("After"); }
From source file:gobblin.metastore.util.DatabaseJobHistoryStoreSchemaManager.java
public static void main(String[] args) throws IOException { if (args.length < 1 || args.length > 2) { printUsage();/*www .jav a2 s . com*/ } Closer closer = Closer.create(); try { CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(new SystemConfiguration()); if (args.length == 2) { config.addConfiguration(new PropertiesConfiguration(args[1])); } Properties properties = getProperties(config); DatabaseJobHistoryStoreSchemaManager schemaManager = closer .register(DatabaseJobHistoryStoreSchemaManager.builder(properties).build()); if (String.CASE_INSENSITIVE_ORDER.compare("migrate", args[0]) == 0) { schemaManager.migrate(); } else if (String.CASE_INSENSITIVE_ORDER.compare("info", args[0]) == 0) { schemaManager.info(); } else { printUsage(); } } catch (Throwable t) { throw closer.rethrow(t); } finally { closer.close(); } }
From source file:Main.java
public static String[] fecthAllTimeZoneIds() { Vector<String> v = new Vector<String>(); String[] ids = TimeZone.getAvailableIDs(); for (int i = 0; i < ids.length; i++) { v.add(ids[i]);/*w w w . j a v a 2 s . co m*/ } java.util.Collections.sort(v, String.CASE_INSENSITIVE_ORDER); v.copyInto(ids); v = null; return ids; }
From source file:Main.java
/** * Creates a case-insensitive set./*from w ww .jav a2 s . c om*/ * * @return An empty case-insensitive set */ public static SortedSet<String> newCaseInsensitiveSet() { TreeSet<String> rv = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); return rv; }
From source file:Main.java
/** * Creates a case-insensitive map./* ww w . j a v a 2 s . c o m*/ * * @param <T> * The object type of the map * @return An empty case-insensitive map */ public static <T> SortedMap<String, T> newCaseInsensitiveMap() { TreeMap<String, T> rv = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); return rv; }
From source file:cn.edu.zjnu.acm.judge.mapper.BestSubmissionsBuilder.java
public static String bestSubmissions(@Param("problemId") long problemId, @Param("pageable") Pageable pageable) { Set<String> dejaVu = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); Sort sort = Optional.ofNullable(pageable.getSort()).map(s -> s.and(DEFAULT_SORT)).orElse(DEFAULT_SORT); Sort.Order[] orders = StreamSupport.stream(sort.spliterator(), false) .filter(order -> ALLOW_COLUMNS.contains(order.getProperty()) && dejaVu.add(order.getProperty())) .toArray(Sort.Order[]::new); final int length = orders.length; log.debug("{}", Arrays.asList(orders)); StringBuilder sb = new StringBuilder( "select " + SubmissionMapper.LIST_COLUMNS + " from solution s where problem_id=").append(problemId) .append(" and score=100 "); for (int i = length - 1; i >= 0; --i) { sb.append("and(user_id"); for (int j = 0; j <= i; ++j) { sb.append(',').append(orders[j].getProperty()); }// w w w. j a va2 s . c om sb.append(")in(select user_id"); for (int j = 0; j < i; ++j) { sb.append(',').append(orders[j].getProperty()); } sb.append(',').append(orders[i].isAscending() ? "min" : "max").append("(") .append(orders[i].getProperty()).append(")").append(orders[i].getProperty()) .append(" from solution where problem_id=").append(problemId).append(" and score=100 "); } for (int i = 0; i < length; ++i) { sb.append("group by user_id)"); } if (length > 0) { sb.append(" order by "); for (int i = 0; i < length; ++i) { if (i > 0) { sb.append(","); } sb.append(orders[i].getProperty()); if (!orders[i].isAscending()) { sb.append(" desc"); } } } return sb.append(" limit ").append(pageable.getOffset()).append(",").append(pageable.getPageSize()) .toString(); }
From source file:com.ebay.erl.mobius.core.JobSetup.java
/** * specify the columns that a mapper needs to emit. *//*from ww w. j a v a 2 s . com*/ public static void setupProjections(JobConf job, Dataset dataset, byte datasetID, Column... projections) { StringBuffer sortedColumns = new StringBuffer(); // dedupe the projection input column name and then sort it. Set<String> uniqueColumnNames = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); for (Column aProjection : projections) { uniqueColumnNames.add(aProjection.getInputColumnName()); } Iterator<String> it = uniqueColumnNames.iterator(); while (it.hasNext()) { sortedColumns.append(it.next()); if (it.hasNext()) sortedColumns.append(","); } job.set(datasetID + ".value.columns", sortedColumns.toString()); // for Mapper only task StringBuffer originalOrder = new StringBuffer(); for (int i = 0; i < projections.length; i++) { originalOrder.append(projections[i].getInputColumnName()); if (i < projections.length - 1) originalOrder.append(","); } job.set(datasetID + ".columns.in.original.order", originalOrder.toString()); }
From source file:com.netflix.genie.web.data.repositories.jpa.specifications.JpaSpecificationUtils.java
/** * Convert a set of TagEntities to the '|' delimited tag search string. * * @param tags The tags to convert/*from ww w. ja va 2 s . c om*/ * @return The tag search string in case insensitive order. e.g. |tag1||tag2||tag3| */ public static String createTagSearchString(final Set<TagEntity> tags) { // Tag search string length max is currently 1024 which will be caught by hibernate validator if this // exceeds that length return TAG_DELIMITER + tags.stream().map(TagEntity::getTag).sorted(String.CASE_INSENSITIVE_ORDER) .reduce((one, two) -> one + TAG_DELIMITER + TAG_DELIMITER + two).orElse("") + TAG_DELIMITER; }
From source file:gov.nih.nci.cabig.caaers.web.table.NullStringComparator.java
public NullStringComparator() { super(); this.stringComparator = String.CASE_INSENSITIVE_ORDER; }
From source file:org.antbear.jee.spring.CaseInsensitiveComparator.java
public int compare(String s1, String s2) { assert s1 != null && s2 != null; return String.CASE_INSENSITIVE_ORDER.compare(s1, s2); }