• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need advice for my problem

 
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have an array which contains some elements but max size is 20

this result array contain the result of user input , eg : USERID

and the result array may contain empty string because of user only enter 5 userid, thus, 15 element of array will contain empty string

now, i want to compare result array with another List elements


the reason i want to compare result array and comparelist, is to make sure that comparelist elements match to result element, if it doesn't, i need display out that what are the element in result array does not match ..

can someone guide me how do i handle my case ..thanks in advance
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out Arrays.asList(Object[] a) and List.containsAll(Collection c).

Angel
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear in mind that containsAll will not take into account the order of the elements. Is that important to you?
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thks for reply, order is not important to me , but most important is i want to make sure that compareList must match to result array

and other concern is how i check the result array element is not match or inside the compareList?

for example, result array have 3 elements , A111, B222, C333
and compareList hv 10 elemnts , which hv 9 element of "A111" but don't hv B222 and C333 , how to i display the message say that "B222 and C333 not in compareList" ....thank you
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic