java - How to remove duplicate elements from a list using apache velocity -


I have a list with duplicate elements, I need to use velocity

example , The duplicate element in the post

  #foreach ($ p in $ terms) $ p.name // will be unique #end   

> For the sake of reason only because others said that it is not possible with velocity, I show it I want to know that this is actually possible with velocity, but still it has not been recommended.

For those who can do this:

  #set ($ uniquePosts = []) #foreach ($ post in post) #set ($ Exists = false) #foreach ($ uniquePost in $ uniquePost) #if ($ uniquePost.name == $ post name) #set ($ exists = true) #break #end #end #if (! $ Exists) ) #set ($ added = $ uniquePosts.add ($ post)) #end #set ($ posts = $ uniquePosts) # Exclusive list: #forach ($ post in $ post) $ post.name #end    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -