When is it desired to not implement toString() in Java?

后端 未结 24 2089
心在旅途
心在旅途 2020-12-10 00:45

A lead developer on my project has taken to referring to the project\'s toString() implementations as \"pure cruft\" and is looking to remove them from the code base.

<
24条回答
  •  粉色の甜心
    2020-12-10 01:06

    We're getting a ConcurrentModificationException thrown out of one of our toString() methods, so there's an occasional drawback. Of course it's our own fault for not making it synchronized.

提交回复
热议问题