Home > Back-end >  Java List removeAll to null object is very slow
Java List removeAll to null object is very slow

Time:02-25

Recently met a problem:
Dynamic lines form, to prevent because the index number to store the empty object, so write a line to the empty before saving operation items. RemoveAll (Collections. The singleton (null)), which is the premise,
Form have five or six dynamic lines, each line up to 15, six in each row, local and test environment problem, the production of this a few dynamic line to an empty object execution 19 s (write the log, sure is time-consuming here), the server status is normal, memory usage seems ok, it's a mystery,

CodePudding user response:

The List is the underlying array for array can shrink the space after deletion, memory can reapply so lead to slow

CodePudding user response:

Combining with the set of duplication empty elements, then delete the empty elements
  • Related