Bookmark Topic Watch Topic
  • New Topic

how to populate unique hashtable list  RSS feed

vicky baba
Posts: 13
  • Mark post as helpful
  • send pies
  • Report post to moderator
//my code
String apl_code_var = null;
String admd_to_srvr_ip_adrs_var = null;
String project_code_var = null;
if (request.getAttribute("server_ip") != null){
iCount = 0;
server_ip = (java.util.Hashtable)request.getAttribute("server_ip");

if (server_ip.size() > 0) {
enumHash = server_ip.elements();
while (enumHash.hasMoreElements()) {
childHash = (java.util.Hashtable)enumHash.nextElement();
project_code_var = (String) childHash.get("PROJECT");
apl_code_var = (String) childHash.get("APL_CODE");
admd_to_srvr_ip_adrs_var = (String)childHash.get("ADMD_TO_SRVR_IP_ADRS");
aplCodeIP[<%=iCount%>] = new getAplCodeIP('<%=project_code_var%>','<%=apl_code_var%>', '<%=admd_to_srvr_ip_adrs_var%>');
//above i want to disply uniqe ' admd_to_srvr_ip_adrs_var'which is duplicate in the list becaze it is depending on project_code_var and apl_code_var,but i want all record(including duplicate 'admd_to_srvr_ip_adrs_var')but i want to show in list only unique list of 'admd_to_srvr_ip_adrs_var'


childHash = null;


enumHash = null;
server_ip = null;

please help

Vivek s.
William Brogden
Author and all-around good cowpoke
Posts: 13078
  • Mark post as helpful
  • send pies
  • Report post to moderator
If you want only unique values, you should be looking at the various Set classes in the collections API.
Ernest Friedman-Hill
author and iconoclast
Posts: 24217
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question in multiple forums. We've been discussing your question here for several days -- if you don't like the answers you're getting, then you'll need to refine your question.

Note that Bill just gave you the same answer as you're already getting in the other thread, by the way.

I'm closing this thread; take this discussion back to the other one.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!