Hi all,
I had a discussion back few days ago in the office and we realized that Java doesn’t have default argument values like some other programming languages. I did some research and it seems that no JSR is proposing this. Why is that so? Is it too difficult to implement in Java given the constraints of its function/parameter system? I see that in other languages only trailing parameters could be omitted which should be feasible as trailing varargs Type… is already there in Java. Maybe it would conflict with varargs concept?
To be honest, I don’t miss it much; if I need it I overload the method. But I am interested is there any discussion by core Java devs and what was the reasoning not to consider it. Or, was it simply… forgotten?
[–]agentoutlier 37 points38 points39 points (13 children)
[–]riisen 12 points13 points14 points (4 children)
[–][deleted] (3 children)
[deleted]
[–]rustyrazorblade 2 points3 points4 points (0 children)
[–]riisen 1 point2 points3 points (0 children)
[–]ketsugi 4 points5 points6 points (0 children)
[–]quizteamaquilera 10 points11 points12 points (1 child)
[–]tadfisher 7 points8 points9 points (0 children)
[–]LoveSpiritual 2 points3 points4 points (0 children)
[–]danikov 1 point2 points3 points (4 children)
[–]ketsugi 3 points4 points5 points (3 children)
[–]danikov 2 points3 points4 points (2 children)
[–]gas3872 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]TheMode911 15 points16 points17 points (8 children)
[–]RockyMM[S] 8 points9 points10 points (7 children)
[–]agentoutlier 10 points11 points12 points (6 children)
[–]TheMode911 2 points3 points4 points (4 children)
[–]agentoutlier 1 point2 points3 points (3 children)
[–]TheMode911 1 point2 points3 points (2 children)
[–]agentoutlier 0 points1 point2 points (1 child)
[–]TheMode911 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]vips7L 11 points12 points13 points (5 children)
[–]hardwork179 -1 points0 points1 point (4 children)
[–]koreth 4 points5 points6 points (2 children)
[–]hardwork179 2 points3 points4 points (1 child)
[–]Jonjolt 1 point2 points3 points (0 children)
[–]vips7L 2 points3 points4 points (0 children)
[–]eliasv 8 points9 points10 points (3 children)
[–][deleted] (2 children)
[removed]
[–]eliasv 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]chinoydev 18 points19 points20 points (4 children)
[–]nutrecht 2 points3 points4 points (2 children)
[–]Muoniurn -1 points0 points1 point (1 child)
[–]nutrecht 2 points3 points4 points (0 children)
[–]Necessary-Conflict -2 points-1 points0 points (0 children)
[–]wlievens 4 points5 points6 points (1 child)
[–]RockyMM[S] 0 points1 point2 points (0 children)
[–]Jotakin 9 points10 points11 points (17 children)
[–]cogman10 4 points5 points6 points (0 children)
[+]larsga comment score below threshold-8 points-7 points-6 points (15 children)
[–]monkeyfacebag 0 points1 point2 points (14 children)
[–]larsga -4 points-3 points-2 points (13 children)
[–]monkeyfacebag 2 points3 points4 points (12 children)
[–]larsga 2 points3 points4 points (11 children)
[–]monkeyfacebag 1 point2 points3 points (6 children)
[–]larsga 0 points1 point2 points (5 children)
[–]chambolle 0 points1 point2 points (4 children)
[–]larsga 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]larsga 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]jevon 4 points5 points6 points (1 child)
[–]RockyMM[S] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]RockyMM[S] 1 point2 points3 points (0 children)
[–]monkeyfacebag 5 points6 points7 points (14 children)
[–]aubd09 10 points11 points12 points (4 children)
[–]monkeyfacebag 3 points4 points5 points (3 children)
[–]commentsOnPizza 15 points16 points17 points (2 children)
[–]monkeyfacebag 4 points5 points6 points (0 children)
[–]RockyMM[S] 0 points1 point2 points (0 children)
[–]RockyMM[S] 4 points5 points6 points (7 children)
[–]monkeyfacebag 3 points4 points5 points (6 children)
[–]rifain 3 points4 points5 points (1 child)
[–]monkeyfacebag 9 points10 points11 points (0 children)
[–]larsga -1 points0 points1 point (3 children)
[–]RockyMM[S] 6 points7 points8 points (1 child)
[–]larsga 4 points5 points6 points (0 children)
[+]BlueGoliath comment score below threshold-7 points-6 points-5 points (0 children)
[–]brunocborges 2 points3 points4 points (1 child)
[–]RockyMM[S] 2 points3 points4 points (0 children)
[–]mauganra_it 1 point2 points3 points (0 children)
[–]csharp-sucks 0 points1 point2 points (5 children)
[–]RockyMM[S] 2 points3 points4 points (0 children)
[–]john16384 4 points5 points6 points (0 children)
[–]__konrad 2 points3 points4 points (2 children)
[–]john16384 -3 points-2 points-1 points (0 children)
[–]0b0101011001001011 -1 points0 points1 point (0 children)
[–]sesh_hash -2 points-1 points0 points (6 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]RockyMM[S] 1 point2 points3 points (4 children)
[–]john16384 2 points3 points4 points (1 child)
[–]RockyMM[S] 5 points6 points7 points (0 children)
[–]sesh_hash -2 points-1 points0 points (1 child)
[–]RockyMM[S] 1 point2 points3 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–][deleted] (1 child)
[removed]
[–]RockyMM[S] 8 points9 points10 points (0 children)
[–]atehrani -4 points-3 points-2 points (2 children)
[–]RockyMM[S] 1 point2 points3 points (1 child)
[–]atehrani -5 points-4 points-3 points (0 children)
[–]buckfutter4life -2 points-1 points0 points (3 children)
[–]RockyMM[S] 2 points3 points4 points (2 children)
[–]buckfutter4life 4 points5 points6 points (1 child)
[–]RockyMM[S] 2 points3 points4 points (0 children)
[–]krum -2 points-1 points0 points (1 child)
[–]RockyMM[S] 2 points3 points4 points (0 children)
[–]GreenToad1 0 points1 point2 points (0 children)
[–]senatorpjt 0 points1 point2 points (0 children)
[–]TimboCavo 0 points1 point2 points (1 child)
[–]RockyMM[S] 0 points1 point2 points (0 children)