how to get index of an element from bean type array list
<p>I want to get indexOf a first name from ArrayList.</p>

<p>Here is my bean class</p>

<pre><code>public class BeanClass {
static String firstname;
String lastname;
int rollno;

public BeanClass(String firstname, String lastname, int rollno) {
    super();
    this.firstname = firstname;
    this.lastname = lastname;
    this.rollno = rollno;
}
</code></pre>

<p>and here is Main Activity</p>

<pre><code>public class MainClass {

    static ArrayList&lt;BeanClass&gt;arraylist=new ArrayList&lt;&gt;();
    static String firstname[]={"kshitij","ravi","prakash","sunil"};
    staticString lastname[]={"singh","sharma","verma","tiwari"};
    staticint rollno[]={1,2,3,4};

    public static void main(String[] args) {

        for (int i = 0; i &lt; firstname.length; i++) {
            BeanClass bean=new BeanClass(firstname[i],lastname[i],rollno[i]);
            arraylist.add(bean);
        }
         System.out.println(arraylist.indexOf("kshitij"));
    }
}
</code></pre>