I hav a doubt regarding the array lists......
check out the program below....
List l=new ArrayList();
l.add(0,"hell") ;
l.add(1,"hello" );
l.add(2,"hello" );
l.add(3,"hello" );
l.add(4,"hello" );
System.out.prin tln("Index: "+(l.indexOf("h ello")));
System.out.prin tln("Index: "+(l.indexOf("h ello")));
OUTPUT:index:1
index:1
my doubt is.....evrytime I get the index of the 1st object......wha t if I want 2 get the index of the duplicate objects other than the 1st and the last objects....??
check out the program below....
List l=new ArrayList();
l.add(0,"hell") ;
l.add(1,"hello" );
l.add(2,"hello" );
l.add(3,"hello" );
l.add(4,"hello" );
System.out.prin tln("Index: "+(l.indexOf("h ello")));
System.out.prin tln("Index: "+(l.indexOf("h ello")));
OUTPUT:index:1
index:1
my doubt is.....evrytime I get the index of the 1st object......wha t if I want 2 get the index of the duplicate objects other than the 1st and the last objects....??
Comment