62,621
社区成员
发帖
与我相关
我的任务
分享
for(int i = startPos; i < (startPos + pm.getPageSize()) ; i++) {
try {
ri = (ResourceItemBean)resultSet.get(i); //取得第(i)个TreeSet
} catch(IndexOutOfBoundsException e) { //到达resultSet末尾需处理
i--;
break;
}
public class ConnServlet {
public static void main(String[] args) {
//调用servlet查询
try {
InetAddress address = InetAddress.getLocalHost();
String localhost = address.getHostAddress();
URL url = new URL("http://" + localhost + ":8080/PSP_Search/servlet/query");
url.openConnection();
System.out.println("连接成功");
} catch(UnknownHostException e) {
System.out.println("找不到主机");
e.printStackTrace();
} catch(MalformedURLException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
}
}
}
List list = ...;
Set set= new LinkedHashSet(list);
list.clear();
list.addAll(set);
TreeSet<String> set = new TreeSet<String>();
set.add("1");
set.add("2");
set.add("3");
for(String str : set){
System.out.println(str);
}