java - How to select distinct value from array items in jsp -


currently, want display value list items want remove duplicate value , showing unique value user.

i tried implement below code doesn't work .

<tr> <td class="col-ss1 col1">currency</td> <c:foreach items="${listproducts}" var="item" varstatus="loop"> <td class="col-ss1 "><c:foreach items="${item.terms}" var="term" varstatus="mainloop">     <c:if test="${(mainloop.index - 1) > 0}">         <c:foreach var="previousterm" items="${item.terms}" begin="0"         end="${mainloop.index-1}" varstatus="inner">     <c:if test="${term.currencytype == previousterm.currencytype }">         <c:set var="flag" value="true"/>     </c:if>         </c:foreach>     </c:if>     <c:if test="${not flag}">${term.currencytype }</c:if> </c:foreach></td> </c:foreach> <!-- <td class="col-ss1 col2">vnĐ / usd / euro</td> <td class="col-ss1 col3">vnĐ / usd / euro</td> <td class="col-ss1 col4">vnĐ / usd / euro</td> <td class="col-ss1 col5">vnĐ / usd / euro</td> --> 

it recommanded on server side, in java class...

list<string> yourlistcontainingdublicates... set<string> uniqueelementsset = new hashset<string>(yourlistcontainingdublicates) 

the hashset constructor identifies duplicates invoking elements' equals() methods.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -