Discussions

Web tier: servlets, JSP, Web frameworks: index of an element in an array

  1. index of an element in an array (6 messages)

    good day, how to find the index of an element in an array.

    Threaded Messages (6)

  2. dude, i think you need some solid basic training in programing , especially using arrays. I hope you are not just another bunch of the so called software enggineers who knows nothing about the ABCD of software engineering and programing fundamentals. If you dont know how to find the index of an element in an array... I wonder whether you know what is an array at all..
  3. reply reg[ Go to top ]

    Thank you Jyothish John, i could find the index by looping through the array. but is there a way like say, arrayList.indexOf(element) by which i may be saved from using for loops. because it's a big String array that i am using. remember say a big NO to looping to find an array index. one final request, Not everyone is an expert. the forum is open to all, beginners, not-so-expert, expert, all category of coders. so if you don't like replying, please don't. Looking at the reply, i really got angry, but after a while i found out that the question wasn't detailed. i know, my question wasn't detailed, but still that question never deserved that kind of reply. o.k leave it aside.... o.k may be... now you can understand my question. is there a way? have a nice day
  4. Re: reply reg[ Go to top ]

    Thank you Jyothish John,
    i could find the index by looping through the array. but is there a way like say, arrayList.indexOf(element) by which i may be saved from using for loops. because it's a big String array that i am using.
    remember say a big NO to looping to find an array index.

    one final request, Not everyone is an expert. the forum is open to all, beginners, not-so-expert, expert, all category of coders. so if you don't like replying, please don't. Looking at the reply, i really got angry, but after a while i found out that the question wasn't detailed. i know, my question wasn't detailed, but still that question never deserved that kind of reply. o.k leave it aside....
    o.k may be... now you can understand my question. is there a way?


    have a nice day
    Now Please expain clearly.. what is your question?
  5. really?[ Go to top ]

    what a worthless non-contribution, not only were you unhelpful, you were just plain rude if someone is looking for answers and they are able to provide most of the details as is the case in this question, and you know how to answer it, rather than ridiculing them by basically saying, "what a supid question you dont even know how to (insert simple task here)" get over your self jackass if youre not gonna be helpful in a forum, why bother responding at all?
  6. The best way will be to use ArrayUtils apache commons. I think ArrayUtils.indexOf(...) will work for you. You can find more details at http://commons.apache.org/lang/api/org/apache/commons/lang/ArrayUtils.html#indexOf(java.lang.Object[],%20java.lang.Object). Its is both effiecient and handles nulls gracefully. Hope that helps. thanks, Amit
  7. Re: index of an element in an array[ Go to top ]

    Let me tell you, even ArrayList in the method indexOf(Object o) searches the whole array by looping. There is better way, I doubt