In the English version I saw this question, but I did not find it in the Russian version. Often, some programmers use private static methods to show that this private method does not use any class variables and methods, others, on the contrary, oppose this approach because it does not use the OOP correctly (we are talking only about private class methods that do not use any class variables and others static methods).
That is, what is more correct for you to use so
public class MyClass { private static void func1() { // со статик ... } } or so
public class MyClass { private void func1() { // без статик ... } } ?
I talked about methods that do not use (and cannot use) fields directly, for example, the boolean isValid(T str) method, which is called in other class methods for many different objects, and which are needed only for this class and carry them to Separate Utils class makes no sense.
As an example of such a method, it is hugeCapacity in ArrayList from Oracle JDK 8 :
private static int hugeCapacity(int minCapacity) { if (minCapacity < 0) // overflow throw new OutOfMemoryError(); return (minCapacity > MAX_ARRAY_SIZE) ? Integer.MAX_VALUE : MAX_ARRAY_SIZE; } PS Any quotes and references to well-known Java authors will help to solve the problem (for example, I know that in ArrayList from Oracle JDK , where the authors are quite well-known Josh Bloch and Neal Gafter, private static methods are used). Maybe you know other evidence of this or that point of view?
That is the perfect answer, this is the answer with quotations for books / articles of well-known Java authors or those who were engaged in OOP theory or design.
речь только о приватных методах класса- is it just "only about private methods of the class" or "about private methods of the class that do not use any variables and methods of the class"? - Alexey Shimansky