Treeset set belonging to one set of data type
Requirements: If you are interested in Treeset type, remove the element at the specified index, but did not get under Set () method, the original demand is String [] array of type de-emphasis, use Treeset solve
One of the hardest way to go:
/ ArrayList deduplication
ArrayList<String> result = new ArrayList<String>();
for(String s : unique){
if(!result.contains(s))
result.add(s);
}
System.out.print ( "ArrayList deduplication Results:");
for(String s : result){
//System.out.println(s);
}
another:
// Treeset store data in the form of
TreeSet<String> unique = new TreeSet<String>();
for (String s: exclu) {// String exclu as before []
unique.add(s);
}
turn into a set list can be resolved:
List <datatype> lst = new ArrayList<datatype>(Set); //
lst.get (index); // index to obtain a corresponding element of the index
Liezi corresponding to the above is:
ArrayList <String> arruni = new ArrayList<String>(unique); for (int i = 0; i < arruni.size(); i++ ) { println(arruni.get(i));
}
Resources:
java string array to implement the method summarized weight, but also the way to sort
Set specified position removed from the element