import javautilCollections;
import javautilList;
public class Test {
public static void main(String[] args) {
List<User> list = new ArrayList<User>();
listadd(new User(11, "Aice", 1));
listadd(new User(11, "john", 2));
listadd(new User(11, "Bob", 3));
listadd(new User(11, "Anni", 4));
Collectionssort(list);
for (User user : list) {
Systemoutprintln(username);
}
}
}
class User implements Comparable<User> {
int age;
String name;
int id;
public User() {
}
public User(int age, String name, int id) {
super();
thisage = age;
thisname = name;
thisid = id;
}
@Override
public int compareTo(User o) {
return thisnamecompareTo(oname);
}
}汉字拼音中如果需要区分,各个拼音必须添加声调,这样才能准确查找。
但这种查询比较烦琐,一般不采用,而是采用模糊查询方式:即将拼音相同的字、词、词组同时查询出来,然后再次选择的方式。
Dim a(10) As Integer
Private Sub Command1_Click()
Randomize
For i = 1 To 10
a(i) = Rnd 90 + 10
List1AddItem a(i)
Next i
End Sub
Private Sub Command2_Click()
For i = 1 To 9
k = i
For j = i + 1 To 10
If a(j) < a(k) Then k = j
Next j
t = a(i): a(i) = a(k): a(k) = t
List2AddItem a(i)
Next i
List2AddItem a(i)
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)