you have to add the element by iterator not by List. The concurrent modification you are getting .It is thrown by List not by ListIterator. Example code : this will throw concurrent modification List list1 = new ArrayList(); list1.add("C"); list1.add("A"); list1.add("B"); ListIterator iterator = list1.listIterator(); while (iterator.hasNext()) { //String element = iterator.next(); // System.out.println(element); if (iterator.next().equals("B")) { // Modify the list while iterating list1.add("D"); // This will throw ConcurrentModificationException } } System.out.println(list); The error *** Exception in thread "main" java.util.ConcurrentModificationException at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013) at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967) ---> see this line **** at Rough.arraylist.main(arraylist.java:36) I hope you understand !!!
Sir in technical interview is there section wise cutoff or overall cutoff? For ex i answered all Springboot questions correctly but couldn't answer any question of database and average answers of core java so will the cutoff decided by overall correct answers or sections wise??
As I can see from the portal, there are openings for only 4+ years of experienced Java Developers. Is there any position available for 3 years experienced candidate?
now i understand why people says that freshers can be more productive/impactfull then the experience ones🙂
bro get more such videos like this..Thank you!
1:57 i used the list Iterator to add an element in the list and it's throwing concurrent modification exception..
List list=new ArrayList();
list.add(1);
list.add(2);
list.add(3);
ListIterator listIterator= list.listIterator();
while (listIterator.hasNext())
{
if(listIterator.next()==3)
{
listIterator.add(4);
}
}
System.out.println(list);
example code : it wont throw
you have to add the element by iterator not by List. The concurrent modification you are getting .It is thrown by List not by ListIterator.
Example code : this will throw concurrent modification
List list1 = new ArrayList();
list1.add("C");
list1.add("A");
list1.add("B");
ListIterator iterator = list1.listIterator();
while (iterator.hasNext()) {
//String element = iterator.next();
// System.out.println(element);
if (iterator.next().equals("B")) {
// Modify the list while iterating
list1.add("D"); // This will throw ConcurrentModificationException
}
}
System.out.println(list);
The error *** Exception in thread "main" java.util.ConcurrentModificationException
at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967) ---> see this line ****
at Rough.arraylist.main(arraylist.java:36)
I hope you understand !!!
Why are using listitterator when there is a foreach loop@@ankitchatterjee1147
@@ankitchatterjee1147 thanks for the explanation. Now I got it
Sir in technical interview is there section wise cutoff or overall cutoff? For ex i answered all Springboot questions correctly but couldn't answer any question of database and average answers of core java so will the cutoff decided by overall correct answers or sections wise??
You need to clear core java first before the interviewer moves to spring boot. Java is required!!!
As I can see from the portal, there are openings for only 4+ years of experienced Java Developers. Is there any position available for 3 years experienced candidate?
There are some referral positions also which are not posted on portal.
Is Capgemini hiring experienced candidates now? Is this a recent interview with Capgemini or an old interview?
this interview happened a few days back.
@@cloudtech5260 Thanks for the reply. Can you please mention the position for which this interview happened or any JOB ID ??
Bro please tell me how can get you call , i did not receive call seems days!!
Which platforms are you using for finding a job?
@@cloudtech5260 noukari and linked In
The market is bit slow, But you can try reaching out to HRs, prepare well so that you grab the first opportunity you get!!
@@cloudtech5260 can tell when market will open like normal , when hiring start in bulk
. When can we expect call as previous year
Are they really offering 11 lakhs for 3 year experienced ??
Yes. They are offering. 👍
Yes they Have given me 12 for 3+
yes
Is this year salary?
Is there any coding round?
Yes there was a coding round. 👍