Search elements in ArrayList in Java

In this tutorial, we will learn how to Search Elements in ArrayList in Java.

ArrayList in Java is a resizable-array implementation of the List interface. ArrayList in Java implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. ArrayList class in Java provides two methods indexOf() and lastIndexOf().

We will use indexOf() and lastIndexOf() methods to search elements in ArrayList in Java. The syntax of indexOf() and lastIndexOf() methods are:

Syntax of indexOf() method:

this method returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

Syntax of lastIndexOf() method:

this method returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

Example:

Output:

 

Related posts

0 Thoughts to “Search elements in ArrayList in Java”

  1. Your comment is awaiting moderation.

    Awesome posts. With thanks!

    viagra uk sale free viagra woman
    viagra 100mg
    compare viagra to cialis and levitra – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  2. Your comment is awaiting moderation.

    You’ve made your position quite effectively..

    the real scoop on online viagra other products like viagra
    generic viagra 100mg
    viagra sales online – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  3. Your comment is awaiting moderation.

    Superb postings. Thanks!

    viagra legitimate mexican viagra bean
    buy viagra online
    scam indian viagra dubai – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  4. Your comment is awaiting moderation.

    Many thanks! Very good stuff!

    viagra dosage liquid viagra shot
    generic viagra 100mg
    viagra cialis india – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  5. Your comment is awaiting moderation.

    Cheers, A good amount of write ups!

    viagra melanoma edinburgh articleid charles linskaill viagra
    buy generic viagra
    generic viagra super active – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  6. Your comment is awaiting moderation.

    You said it well.

    cheap female viagra 50 mg viagra from canadian pharmacy
    viagra without a doctors prescription
    viagra vitamins – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  7. Your comment is awaiting moderation.

    Fine write ups. With thanks!

    mens viagra blog what to expect from viagra
    generic viagra online
    cheap viagra soft tabs – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  8. Your comment is awaiting moderation.

    Thanks! A good amount of data.

    cost of viagra pill pfizer and viagra
    cheap viagra
    discount viagra prescription retail – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  9. Your comment is awaiting moderation.

    Amazing all kinds of useful information!

    women and viagra viagra and heartworm in dogs
    generic viagra 100mg
    viagra copy – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  10. Your comment is awaiting moderation.

    Very good tips. Thanks!

    viagra grapefruit maximizing effects of viagra
    viagra without a doctor prescription
    diabetes viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  11. Your comment is awaiting moderation.

    Many thanks. Helpful stuff.

    search viagra edinburgh phentermine find where can i buy viagra online
    generic viagra
    who owns viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  12. Your comment is awaiting moderation.

    Very well expressed truly! .

    viagra trial packs orexis as good as viagra
    viagra for sale uk
    viagra cialis from canada – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  13. Your comment is awaiting moderation.

    You reported that very well.

    keywords generic viagra does viagra effect breathing
    viagra without a doctor prescription
    viagra soft tabs review – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  14. Your comment is awaiting moderation.

    Many thanks, Quite a lot of facts!

    viagra purchase by phone will my insurance cover viagra
    viagra without a doctors prescription
    drug interractions flomax viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  15. Your comment is awaiting moderation.

    With thanks, A good amount of postings.

    viagra uk chemist non prescription hongry hawg texas viagra
    buy generic viagra
    viagra pd – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  16. Your comment is awaiting moderation.

    With thanks, Loads of data.

    viagra nation viagra diarrhea
    viagra online
    viagra infidelity studies – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  17. Your comment is awaiting moderation.

    Very good postings. Regards!

    female viagra cream who invented viagra
    viagra online
    ocd and viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  18. Your comment is awaiting moderation.

    Incredible quite a lot of useful tips.

    easy buy viagra viagra heart attack
    buy viagra online
    rush limbaugh viagra island – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  19. Your comment is awaiting moderation.

    Superb data, With thanks.

    sex without viagra perscription viagra columbus ohio
    buy viagra
    cheap online pharmacy viagra viagra – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  20. Your comment is awaiting moderation.

    Valuable facts. With thanks.

    buy no prior viagra cialis levitra buy cheap online prescription viagra
    buy viagra
    generic viagra vls pharmacy – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  21. Your comment is awaiting moderation.

    Nicely put, Kudos!

    search results viagra buy online viagra synthesis
    viagra without a doctor prescription
    amoxicillin zyrtec no prescription required viagra – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  22. Your comment is awaiting moderation.

    Truly all kinds of wonderful knowledge.

    viagra online no doctor prescription dose of viagra
    buy generic viagra
    viagra as a recreational drug – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  23. Your comment is awaiting moderation.

    Appreciate it, Numerous stuff!

    cb viagra kit fda schedule for viagra
    generic viagra online
    does viagra help with premature ejaculation – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  24. Your comment is awaiting moderation.

    Kudos! Terrific stuff.

    viagra costs reglement viagra
    viagra for sale uk
    getting viagra in cagayan de oro – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  25. Your comment is awaiting moderation.

    Excellent knowledge. Thanks a lot.

    viagra on internet appearance of viagra
    viagra online
    viagra prescription online – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  26. Your comment is awaiting moderation.

    Kudos, A good amount of forum posts.

    viagra free porn pages edinburgh search viagra boring
    buy viagra
    viagra online diagnosis – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  27. Your comment is awaiting moderation.

    Appreciate it! Ample stuff!

    free viagra prescription buy viagra s journal
    viagra without a doctors prescription
    buy viagra from britain – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  28. Your comment is awaiting moderation.

    You expressed this well!

    viagra long term side-effects canadian cheap viagra
    buy generic viagra
    viagra hearing – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  29. Your comment is awaiting moderation.

    Very good posts. Regards.

    legal 100 mg viagra super f m pharmacy new york viagra
    buy generic viagra
    viagra herbal substitute – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  30. Your comment is awaiting moderation.

    Thanks, I appreciate this.

    mixing viagra and alcohol viagra us compare prices
    generic viagra
    cialis or super viagra – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  31. Your comment is awaiting moderation.

    This is nicely expressed! !

    teen viagra useage viagra and blindness
    generic viagra 100mg
    viagra best taken when – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  32. Your comment is awaiting moderation.

    Reliable facts. Cheers!

    car in viagra commercial viagra generic oregon
    buy generic viagra
    viagra manufacturers – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  33. Your comment is awaiting moderation.

    Really many of excellent facts!

    gnc viagra viagra cialis herbal samples
    viagra without a doctors prescription
    free sample of viagra or cialis – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  34. Your comment is awaiting moderation.

    Really loads of beneficial information.

    viagra forum generic viagra indian
    viagra generic
    viagra scotland – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  35. Your comment is awaiting moderation.

    Very good facts. Kudos!

    natural viagra formulas buy cheap uk viagra
    viagra for women
    natural viagra replacement – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  36. Your comment is awaiting moderation.

    Seriously plenty of terrific material!

    viagra starter free viagra samples
    viagra pills
    cheapest online price for generic viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  37. Your comment is awaiting moderation.

    Helpful stuff. Kudos!

    womans backlash to viagra does health insurance cover viagra
    buy viagra online
    viagra on cnn advertisement – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  38. Your comment is awaiting moderation.

    Useful content. Kudos!

    viagra grapefruit viagra boner
    generic viagra 100mg
    jelly viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  39. Your comment is awaiting moderation.

    You’ve made your point.

    buy generic viagra viagra warnings
    viagra without a doctors prescription
    viagra cialis levitra what’s best – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  40. Your comment is awaiting moderation.

    Regards. Loads of posts.

    how to obtain viagra song on the new viagra commercial
    viagra pills
    over the counter viagra walgreens – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  41. Your comment is awaiting moderation.

    Excellent material. With thanks!

    glucophage viagra new female viagra
    viagra without a doctor prescription
    order viagra online a href – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  42. Your comment is awaiting moderation.

    Thanks, I value it!

    491 viagra heart 708 viagra in the usa
    viagra online
    erection pills viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  43. Your comment is awaiting moderation.

    Valuable knowledge. Regards.

    canada’s viagra viagra the facts
    buy generic viagra
    viagra cialis levitra how to use – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  44. Your comment is awaiting moderation.

    Point clearly utilized!.

    faq viagra viagra rrp australia cost
    viagra online
    viagra post coitis – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  45. Your comment is awaiting moderation.

    Awesome tips. Appreciate it.

    prevent viagra spam in yahoo mail generic viagra no prescriptio
    viagra for sale uk
    viagra find sites computer – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  46. Your comment is awaiting moderation.

    Whoa tons of awesome facts.

    take viagra cialis together viagra paypal accepted
    generic viagra online
    sample of viagra – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  47. Your comment is awaiting moderation.

    Helpful info. Cheers.

    is there viagra for women kaboom viagra
    viagra 100mg
    viagra cerebral hemorrage – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  48. Your comment is awaiting moderation.

    Thanks a lot! Ample postings!

    ten minute viagra viagra online rss feed
    viagra pills
    bendroflumethiazide viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  49. Your comment is awaiting moderation.

    Thanks, Quite a lot of information!

    does viagra contain arginine viagra office ontario canada
    viagra without a doctor prescription
    safe alternative to viagra – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  50. Your comment is awaiting moderation.

    Thanks a lot! Awesome stuff.

    drinking and viagra medication on line viagra
    buy generic viagra
    viagra in nanaimo – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  51. Your comment is awaiting moderation.

    Incredible a lot of valuable knowledge!

    filter network q viagra should teens use viagra
    viagra without a doctor prescription
    viagra etc – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  52. Your comment is awaiting moderation.

    This is nicely said! .

    viagra on heart medication make viagra even better
    viagra for women
    college viagra – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  53. Your comment is awaiting moderation.

    You said that well.

    viagra viagra buy search find free viagra birthday cake
    viagra pills
    making the most of viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  54. Your comment is awaiting moderation.

    Great content. Regards.

    viagra dependence viagra achat sur internet
    buy generic viagra
    viagra corporate office – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  55. Your comment is awaiting moderation.

    Reliable content. Appreciate it.

    anal viagra fucking on viagra video
    generic viagra 100mg
    open label viagra and antidepressant study – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  56. Your comment is awaiting moderation.

    Amazing plenty of wonderful knowledge.

    the truth about viagra soft tabs levitra cilias viagra
    viagra 100mg
    viagra pill pictures – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  57. Your comment is awaiting moderation.

    You said it very well..

    about viagra doctor millington tn viagra
    buy viagra online
    where to buy viagra in thanet – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  58. Your comment is awaiting moderation.

    Regards, I like it.

    chanson viagra viagra paperweight closeout
    buy viagra online
    seek natural herbal viagra products – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  59. Your comment is awaiting moderation.

    This is nicely expressed. .

    medical history of viagra use chocolate viagra for women
    buy viagra
    viagra free sites results find computer – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  60. Your comment is awaiting moderation.

    Thanks, Excellent stuff.

    test done on viagra viagra generic low price
    generic viagra online
    mushrooms and viagra – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  61. Your comment is awaiting moderation.

    You revealed this fantastically.

    viagra and uric acid stones generic viagra vega
    viagra without a doctors prescription
    non prescription type viagra – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  62. Your comment is awaiting moderation.

    Many thanks! Plenty of stuff.

    viagra hgh natural viagra subsitute
    cheap viagra
    g postmessage viagra guest forum – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  63. Your comment is awaiting moderation.

    Really lots of fantastic data!

    what sex like man viagra viagra healthy
    viagra online
    old man wants to try viagra – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  64. Your comment is awaiting moderation.

    Nicely put, Regards!

    pfizer and viagra natural alternatives and viagra and reviews
    viagra for sale uk
    viagra ro cialis which is better – https://genericviagramsl.com

    DavidRof
    TerenceNUG
    Victorpen

  65. Your comment is awaiting moderation.

    Regards. I value this.

    viagra corvette commercial christine rudakewycz viagra
    generic viagra 100mg
    cheap kamagra uk viagra – https://genericviagrarcp.com

    DavidRof
    TerenceNUG
    Victorpen

  66. Your comment is awaiting moderation.

    You actually stated this well.

    cock on viagra video amino acid viagra
    generic viagra online
    cheap order viagra – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

  67. Your comment is awaiting moderation.

    Regards, Loads of data.

    overnite shipping viagra chao sheng long company viagra
    generic viagra 100mg
    trick viagra – https://genericviagrantx.com

    DavidRof
    TerenceNUG
    Victorpen

Leave a Comment