Role bean = new role ();
Bean.setroleID ("123456");
List testlist = new arraylist ();
TestList.Add (bean);
Role.setroleID ("777777");
TestList.Add (bean);
This will become 777777 like this.
But if it is
Role bean = new role ();
Role bean1 = new role ();
Bean.setroleID ("123456");
Bean1.setroleId ("654321");
List testlist = new arraylist ();
TestList.Add (bean);
TestList.Add (bean1);
List map = new arraylist ();
Role role = new role ();
For (int i = 0; i IF (TestList.get (i) instanceof role { Role = (role) TestList.get (i); // role.setroleId ("..."); Map.Add (role); } } Then the ID value of the two objects will become 654321 If the comment is removed, the ID will become .........