I recently came across a piece of code in which I found an interface with constants only . And these constants were available in classes using static imports. The constants were larger (from 30 to 50).
Personally, I do not consider this a good practice. That's why it is called the Constant Interface Antipattern in accordance with efficient Java. I find no reason for such coding.
In addition, static import should be used ONLY if in our application several classes are imported by several classes.
Can any of you please tell me if there are any other good reasons to use for interface constants only?
source
share