Quickie pseudo-aesthetics question:
For field declarations, the following is allowed:
int i, j, k;
providing three variables for integers. Does anything similar exist for method declarations, ala:
public int getI() {/* ... */},
getJ() {/* ... */},
getK() {/* ... */};
so that the method accessibility, return type, etc don't have to be redundantly specified? I can imagine some cases where this sort of syntax would seem really beneficial (e.g., methods with an assortment of argument sets allowed), so I'm hoping it's in there somewhere. I've tried the above, and it doesn't seem to work.
EDIT: relative to KLE's question about needs, there isn't a requirement, it's more about wants. The most annoying thing I'm facing is that I have a class of a bunch algorithms that are static (and should be static, as they don't depend on anything but their arguments) but take a generic argument with some restrictions. The restrictions are the same for every method, and it really uglies up the code to have to repeat them for every method, but putting them in the class definition (i.e., public class Foo<U extends Bar>
) seems to preclude making the methods static.
ALSO: Can someone elaborate on why using sharing the fields declaration is considered bad practice? I think I can appreciate that perspective in the commercial application realm, but it seems a little strange in the scientific application realm - sharing types fields seems an obvious and simple means of indicating when things should be the same kind of thing.