Java. util. concurrentmodificationexception exception because you cannot modify yourself at the same time
I have now created an unlimited classification and hibernate self-Association. When adding products, I can only add subnodes of product types. First, I can find all types. Then, put a node without a subnode (that is, a subnode) into a set.
Code:
- List <types> array = goodsserviceimpl. selecttype ();
- If (array! = NULL ){
- For (types arr: array ){
- If (! Arr. gettypeses (). isempty ()){
- Array. Remove (ARR );
- }
- }
- }
Later, the exception java. util. concurrentmodificationexception occurred. The solution is as follows:
Code:
- Solution:
- List <types> type = goodsserviceimpl. selecttype ();
- List <types> array = new arraylist <types> ();
- If (type! = NULL ){
- For (types arr: type ){
- If (! Arr. gettypeses (). isempty ()){
- } Else {
- Array. Add (ARR );
- }
- }
- }