Here you can find the source of uniqueExclusiveSort(String[] values, String[] removeValues)
Parameter | Description |
---|---|
values | to consider |
removeValues | values to remove from values |
protected static String[] uniqueExclusiveSort(String[] values, String[] removeValues)
//package com.java2s; /************************************************************************************** * Copyright (C) 2008 EsperTech, Inc. All rights reserved. * * http://esper.codehaus.org * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * **************************************************************************************/ import java.util.*; public class Main { /**/*from w w w . ja va 2s.c o m*/ * Remove from values all removeValues and build a unique sorted result array. * @param values to consider * @param removeValues values to remove from values * @return sorted unique */ protected static String[] uniqueExclusiveSort(String[] values, String[] removeValues) { Set<String> unique = new HashSet<String>(); unique.addAll(Arrays.asList(values)); for (String removeValue : removeValues) { unique.remove(removeValue); } String[] uniqueArr = unique.toArray(new String[unique.size()]); Arrays.sort(uniqueArr); return uniqueArr; } }