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.

    Many thanks! Lots of material!

    https://www.viagrawithoutdoctorntx.com/
    mixing alcohol viagra
    generic viagra online
    viagra onlinwe
    viagra for women

  2. Your comment is awaiting moderation.

    Wonderful write ups. Regards!
    https://www.viagrawithoutadoctorsmim.com/
    viagra blood pressure cuff
    viagra generic
    no prescription cheap viagra
    viagra online

  3. Your comment is awaiting moderation.

    Incredible loads of amazing material.
    https://www.genericviagracubarx.com/
    what is generic viagra called
    buy generic viagra
    is generic viagra fda approved
    buy generic viagra

  4. Your comment is awaiting moderation.

    Really tons of amazing information!
    https://www.viagrawithoutadoctorsmim.com/
    viagra doses how many milligrams
    generic viagra 100mg
    online order for viagra
    viagra pills

  5. Your comment is awaiting moderation.

    Thank you! I value this.
    https://www.viagrawithoutdoctorntx.com/
    viagra rude cartoons
    viagra 100mg
    chiense viagra
    viagra without a doctors prescription

  6. Your comment is awaiting moderation.

    You stated this adequately.
    https://www.viagrawithoutdoctorntx.com/
    life of viagra
    generic viagra 100mg
    girl viagra tube
    buy viagra

  7. Your comment is awaiting moderation.

    Thanks! An abundance of material.

    https://www.genericviagracubarx.com/
    buy viagra internet
    generic viagra
    best price on viagra
    buy generic viagra

  8. Your comment is awaiting moderation.

    Many thanks. Excellent stuff!
    https://www.viagrawithoutdoctorbnt.com/
    viagra online no prescription
    viagra without a doctor prescription
    generic stats viagra
    generic viagra

  9. Your comment is awaiting moderation.

    Thanks a lot. A good amount of information!

    https://www.viagrawithoutadoctorsmim.com/
    viagra post coitis
    viagra without a doctors prescription
    viagra with out a prescription
    buy generic viagra

  10. Your comment is awaiting moderation.

    Wow a good deal of terrific material!
    https://www.viagrawithoutadoctorsmim.com/
    how long does viagra keep
    generic viagra online
    class action against pfizer for viagra
    viagra online

  11. Your comment is awaiting moderation.

    Thanks a lot. Fantastic stuff.
    https://www.viagrawithoutadoctorsmim.com/
    viagra magnetic strip
    viagra for women
    sale viagra
    buy viagra

  12. Your comment is awaiting moderation.

    You actually revealed it perfectly.
    https://www.genericviagracubarx.com/
    subaction showcomments viagra smyle older
    viagra 100mg
    viagra wiki
    generic viagra online

  13. Your comment is awaiting moderation.

    Truly all kinds of excellent material.
    https://www.viagrawithoutadoctorsmim.com/
    viagra used for cardiac issues
    buy viagra
    search viagra find cheap pages
    cheap viagra

  14. Your comment is awaiting moderation.

    You made your point pretty effectively..
    https://www.genericviagracubarx.com/
    viagra like drugs for female sexuality
    viagra online
    ceneric viagra
    viagra 100mg

  15. Your comment is awaiting moderation.

    With thanks! A good amount of facts.

    https://www.viagrawithoutdoctormsn.com/
    can l-arginine be taken with viagra
    viagra online
    battery viagra
    viagra for women

  16. Your comment is awaiting moderation.

    Seriously many of wonderful data!
    https://www.viagrawithoutdoctormsn.com/
    order viagra softtabs
    viagra for sale uk
    reditabs buy viagra
    viagra 100mg

  17. Your comment is awaiting moderation.

    Thank you, Plenty of advice.

    https://www.viagrawithoutadoctorsmim.com/
    pfizer viagra on line
    generic viagra 100mg
    non prexcription viagra
    viagra online

  18. Your comment is awaiting moderation.

    Really a lot of useful info.
    https://www.viagrawithoutadoctorsmim.com/
    real geunine viagra
    viagra generic
    viagra company info
    viagra generic

  19. Your comment is awaiting moderation.

    Seriously lots of valuable tips.
    https://www.viagrawithoutdoctorntx.com/
    propecia cialis viagra
    viagra generic
    viagra through customs from mexico
    viagra without a doctors prescription

  20. Your comment is awaiting moderation.

    Valuable stuff. Cheers!
    https://www.genericviagracubarx.com/
    viagra scottland
    cheap viagra
    vitamins vs viagra
    generic viagra

  21. Your comment is awaiting moderation.

    Kudos! Ample advice.

    https://www.genericviagracubarx.com/
    viagra free sites computer edinburgh search
    viagra for women
    viagra covered by kaiser insurance
    buy generic viagra

  22. Your comment is awaiting moderation.

    This is nicely expressed! .
    https://www.viagrawithoutdoctormsn.com/
    subaction showcomments viagra archive older
    viagra without a doctors prescription
    viagra discount card
    cheap viagra

  23. Your comment is awaiting moderation.

    Truly many of helpful info!
    https://www.viagrawithoutadoctorsmim.com/
    low cost alternatives and to viagra
    viagra 100mg
    why is viagra brand better
    viagra generic

  24. Your comment is awaiting moderation.

    Seriously many of amazing info.
    https://www.genericviagracubarx.com/
    generic viagra wiki
    generic viagra
    subaction showcomments viagra start from older
    viagra pills

  25. Your comment is awaiting moderation.

    With thanks! Plenty of facts!

    https://www.genericviagracubarx.com/
    ever use viagra
    viagra for sale uk
    viagra lasting longer
    cheap viagra

  26. Your comment is awaiting moderation.

    Nicely put, Kudos.
    https://www.viagrawithoutdoctorbnt.com/
    taking epinephrine with viagra
    buy viagra
    buy viagra costa rica
    viagra for sale uk

  27. Your comment is awaiting moderation.

    Truly a lot of good advice.
    https://www.genericviagracubarx.com/
    canadian viagra safety
    buy generic viagra
    buy internet viagra
    viagra without a doctors prescription

  28. Your comment is awaiting moderation.

    Awesome material, Thanks a lot.
    https://www.viagrawithoutdoctormsn.com/
    generic viagra united states
    viagra without a doctor prescription
    canada viagra
    viagra online

  29. Your comment is awaiting moderation.

    Whoa a good deal of great material!
    https://www.viagrawithoutdoctorntx.com/
    shirt viagra
    generic viagra 100mg
    viagra on prescription in the uk
    viagra for sale uk

  30. Your comment is awaiting moderation.

    Whoa loads of wonderful tips!
    https://www.viagrawithoutdoctorntx.com/
    viagra sex video
    viagra without a doctors prescription
    boston medical center viagra
    viagra 100mg

  31. Your comment is awaiting moderation.

    With thanks! Good stuff!
    https://www.genericviagracubarx.com/
    viagra pattent
    generic viagra 100mg
    50mg viagra softtabs
    viagra generic

  32. Your comment is awaiting moderation.

    You said it nicely..
    https://www.viagrawithoutdoctormsn.com/
    what color is viagra
    cheap viagra
    what’s better cialis or viagra
    viagra without a doctors prescription

  33. Your comment is awaiting moderation.

    You’ve made your point extremely clearly.!
    https://www.viagrawithoutdoctorntx.com/
    buy viagra with cashiers check
    generic viagra online
    buy viagra online without a prescription
    generic viagra online

  34. Your comment is awaiting moderation.

    With thanks. Numerous tips!

    https://www.viagrawithoutdoctorntx.com/
    find viagra free sites search
    cheap viagra
    indian pharmacy viagra
    viagra pills

  35. Your comment is awaiting moderation.

    Kudos. Numerous posts!

    https://www.genericviagracubarx.com/
    viagra best price costco
    viagra for women
    viagra find viagra edinburgh search
    buy viagra

  36. Your comment is awaiting moderation.

    Thank you! I value it!
    https://www.genericviagracubarx.com/
    viagra without a perscription
    cheap viagra
    viagra affiliate program
    viagra online

  37. Your comment is awaiting moderation.

    Whoa lots of valuable facts.
    https://www.viagrawithoutdoctormsn.com/
    viagra levitra cialis and face flushing
    viagra without a doctor prescription
    patent on viagra
    generic viagra 100mg

  38. Your comment is awaiting moderation.

    Amazing a lot of valuable info.
    https://www.viagrawithoutdoctormsn.com/
    aetna viagra amount
    generic viagra 100mg
    children taking viagra
    generic viagra 100mg

  39. Your comment is awaiting moderation.

    Fantastic content. Kudos.
    https://www.viagrawithoutdoctormsn.com/
    viagra death
    viagra 100mg
    buy viagra 50mg
    generic viagra 100mg

  40. Your comment is awaiting moderation.

    Very well spoken without a doubt. !
    https://www.genericviagracubarx.com/
    viagra and imitrex
    viagra online
    viagra vs better hard on
    viagra 100mg

  41. Your comment is awaiting moderation.

    Thanks! A good amount of tips!

    https://www.viagrawithoutdoctorntx.com/
    men who have tried viagra
    generic viagra online
    online is online viagra real
    viagra pills

  42. Your comment is awaiting moderation.

    Seriously many of awesome tips!
    https://www.viagrawithoutdoctorbnt.com/
    hl en q viagra
    generic viagra
    viagra pro online
    viagra online

  43. Your comment is awaiting moderation.

    Nicely put. Thanks!
    https://www.viagrawithoutdoctorntx.com/
    cheap viagra ambien generic cananda
    viagra without a doctor prescription
    viagra half price generix
    viagra without a doctor prescription

  44. Your comment is awaiting moderation.

    Cheers! Lots of information!

    https://www.viagrawithoutdoctorntx.com/
    paul thorn viagra
    viagra without a doctor prescription
    other products like viagra
    viagra for sale uk

  45. Your comment is awaiting moderation.

    You said it nicely..
    https://www.genericviagracubarx.com/
    nu virgos viagra
    viagra pills
    what does viagra do to females
    cheap viagra

  46. Your comment is awaiting moderation.

    Amazing write ups. With thanks.
    https://www.viagrawithoutdoctorntx.com/
    review online viagra
    viagra for women
    citrate generic sildenafil viagra
    viagra pills

  47. Your comment is awaiting moderation.

    You definitely made your point.
    https://www.viagrawithoutdoctormsn.com/
    viagra erectile disfunction penis
    viagra without a doctors prescription
    viagra burning pain right side
    buy generic viagra

  48. Your comment is awaiting moderation.

    Good posts. Cheers!
    https://www.viagrawithoutdoctormsn.com/
    buy kamagra viagra india
    cheap viagra
    viagra available at boots online
    viagra without a doctors prescription

  49. Your comment is awaiting moderation.

    You actually said this wonderfully!
    https://www.viagrawithoutdoctormsn.com/
    viagra overnight best price
    generic viagra online
    viagra without rx
    generic viagra 100mg

  50. Your comment is awaiting moderation.

    Great info. Many thanks!
    https://www.viagrawithoutdoctorntx.com/
    does viagra effect breathing
    generic viagra 100mg
    viagra lawsuit updates in march 2009
    buy generic viagra

  51. Your comment is awaiting moderation.

    Fantastic data. Thank you.
    https://www.viagrawithoutdoctorbnt.com/
    using less viagra
    viagra without a doctor prescription
    retail price comparison on viagra
    viagra 100mg

  52. Your comment is awaiting moderation.

    Thanks! An abundance of postings!

    https://www.viagrawithoutdoctormsn.com/
    take viagra soft tabs
    viagra generic
    can viagra be outdated
    buy generic viagra

  53. Your comment is awaiting moderation.

    Thanks a lot, A lot of info!

    https://www.genericviagracubarx.com/
    brochures on viagra
    generic viagra
    injections in lieu of viagra
    viagra 100mg

  54. Your comment is awaiting moderation.

    Wow many of beneficial tips.
    https://www.viagrawithoutdoctormsn.com/
    ending viagra use
    generic viagra 100mg
    who makes viagra
    viagra online

  55. Your comment is awaiting moderation.

    You suggested this superbly.
    https://www.viagrawithoutdoctormsn.com/
    viagra buy it online now
    generic viagra 100mg
    concerta and viagra
    generic viagra 100mg

  56. Your comment is awaiting moderation.

    You’ve made the point!
    https://www.viagrawithoutadoctorsmim.com/
    best viagra online
    buy generic viagra
    viagra and money order
    viagra without a doctors prescription

  57. Your comment is awaiting moderation.

    Valuable advice. Cheers.
    https://www.viagrawithoutadoctorsmim.com/
    effect of viagra on divorce rate
    buy viagra online
    viagra treatment for post vasectomy pain
    viagra generic

  58. Your comment is awaiting moderation.

    Regards! Excellent stuff.
    https://www.viagrawithoutdoctorntx.com/
    links to viagra in hotmail
    viagra 100mg
    pros and cons of generic viagra
    cheap viagra

  59. Your comment is awaiting moderation.

    You stated this terrifically.
    https://www.viagrawithoutdoctorntx.com/
    outdated viagra
    viagra without a doctor prescription
    why my viagra won’t work
    generic viagra online

  60. Your comment is awaiting moderation.

    Nicely put, Appreciate it!
    https://www.viagrawithoutdoctormsn.com/
    viagra erectile disfunction penis
    viagra pills
    cheap viagra 25mg
    viagra 100mg

  61. Your comment is awaiting moderation.

    You said it nicely.!
    https://www.viagrawithoutdoctorbnt.com/
    other viagra
    viagra pills
    viagra samples free generic
    buy viagra

  62. Your comment is awaiting moderation.

    Nicely put. Appreciate it!
    https://www.genericviagracubarx.com/
    old man on viagra
    viagra for sale uk
    calcium chanel blocker and viagra
    buy viagra

  63. Your comment is awaiting moderation.

    Truly plenty of wonderful information.
    https://www.viagrawithoutdoctormsn.com/
    buying viagra over the internet
    viagra pills
    viagra pounding
    viagra for sale uk

  64. Your comment is awaiting moderation.

    Truly plenty of useful tips!
    https://www.viagrawithoutadoctorsmim.com/
    whats best viagra cialis
    viagra pills
    viagra plus
    viagra online

  65. Your comment is awaiting moderation.

    Well expressed indeed. !
    https://www.genericviagracubarx.com/
    viagra discount pharmacy
    viagra for women
    viagra erection pictures
    buy generic viagra

  66. Your comment is awaiting moderation.

    Whoa many of helpful data!
    https://www.viagrawithoutdoctorbnt.com/
    viagra without a prescripton
    viagra without a doctors prescription
    watermellon natural viagra
    viagra for women

  67. Your comment is awaiting moderation.

    Great content. Kudos.
    http://viagrapego.com/
    viagra treats children s lethal hypertension
    buy generic viagra
    viagra generic equivalent
    viagra pills

  68. Your comment is awaiting moderation.

    You expressed it perfectly!
    http://viagrawithoutadoctormsn.com/
    viagra herb alternative
    viagra online
    craigslist viagra markham ontario
    generic viagra

  69. Your comment is awaiting moderation.

    Thanks, A lot of stuff.

    http://viagrawithoutadoctormsn.com/
    viagra use for enlarged heart
    generic viagra
    free sites results computer viagra find
    viagra pills

  70. Your comment is awaiting moderation.

    Nicely put, Cheers.
    http://viagrawithoutadoctormsn.com/
    non presciption viagra replacements
    buy viagra
    buy viagra stockton ca
    buy viagra

  71. Your comment is awaiting moderation.

    Wow quite a lot of useful advice.
    http://viagrawithoutadoctormsn.com/
    you made everything possible again viagra
    generic viagra 100mg
    viagra price comparsions
    buy viagra online

  72. Your comment is awaiting moderation.

    Kudos, Lots of facts.

    http://viagrawithoutadoctormsn.com/
    rush illegal viagra
    viagra without a doctors prescription
    using levitra and viagra together
    cheap viagra

  73. Your comment is awaiting moderation.

    Information effectively considered!!
    http://viagrawithoutadoctormsn.com/
    will viagra keep erection after climax
    viagra for women
    personal experience using viagra
    cheap viagra

  74. Your comment is awaiting moderation.

    You said it adequately..
    http://viagrawithoutadoctormsn.com/
    viagra explained
    viagra pills
    propecia rite aid online viagra
    generic viagra

  75. Your comment is awaiting moderation.

    Thanks a lot. Good information!
    http://viagrawithoutadoctorsntx.com/
    viagra and cardiomyopathy left ventricular
    viagra for women
    generic viagra is safe
    buy viagra online

Leave a Comment