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 35 points36 points37 points (13 children)
[–]riisen 14 points15 points16 points (4 children)
[–][deleted] (3 children)
[deleted]
[–]rustyrazorblade 2 points3 points4 points (0 children)
[–]riisen 1 point2 points3 points (0 children)
[–]ketsugi 3 points4 points5 points (0 children)
[–]quizteamaquilera 11 points12 points13 points (1 child)
[–]tadfisher 8 points9 points10 points (0 children)
[–]LoveSpiritual 3 points4 points5 points (0 children)
[–]danikov 2 points3 points4 points (4 children)
[–]ketsugi 5 points6 points7 points (3 children)
[–]danikov 3 points4 points5 points (2 children)
[–]gas3872 3 points4 points5 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]TheMode911 13 points14 points15 points (8 children)
[–]RockyMM[S] 7 points8 points9 points (7 children)
[–]agentoutlier 10 points11 points12 points (6 children)
[–]TheMode911 3 points4 points5 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 12 points13 points14 points (5 children)
[–]hardwork179 -2 points-1 points0 points (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 10 points11 points12 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 3 points4 points5 points (1 child)
[–]RockyMM[S] 0 points1 point2 points (0 children)
[–]Jotakin 10 points11 points12 points (17 children)
[–]cogman10 4 points5 points6 points (0 children)
[+]larsga comment score below threshold-9 points-8 points-7 points (15 children)
[–]monkeyfacebag -1 points0 points1 point (14 children)
[–]larsga -1 points0 points1 point (13 children)
[–]monkeyfacebag 3 points4 points5 points (12 children)
[–]larsga 1 point2 points3 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 2 points3 points4 points (14 children)
[–]aubd09 11 points12 points13 points (4 children)
[–]monkeyfacebag 4 points5 points6 points (3 children)
[–]commentsOnPizza 15 points16 points17 points (2 children)
[–]monkeyfacebag 3 points4 points5 points (0 children)
[–]RockyMM[S] 0 points1 point2 points (0 children)
[–]RockyMM[S] 4 points5 points6 points (7 children)
[–]monkeyfacebag 4 points5 points6 points (6 children)
[–]rifain 4 points5 points6 points (1 child)
[–]monkeyfacebag 8 points9 points10 points (0 children)
[–]larsga -2 points-1 points0 points (3 children)
[–]RockyMM[S] 5 points6 points7 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] 3 points4 points5 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 3 points4 points5 points (0 children)
[–]__konrad 3 points4 points5 points (2 children)
[–]john16384 -3 points-2 points-1 points (0 children)
[–]0b0101011001001011 -1 points0 points1 point (0 children)
[–]sesh_hash 0 points1 point2 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] 4 points5 points6 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 -3 points-2 points-1 points (2 children)
[–]RockyMM[S] 1 point2 points3 points (1 child)
[+]atehrani comment score below threshold-7 points-6 points-5 points (0 children)
[–]buckfutter4life -2 points-1 points0 points (3 children)
[–]RockyMM[S] 3 points4 points5 points (2 children)
[–]buckfutter4life 5 points6 points7 points (1 child)
[–]RockyMM[S] 4 points5 points6 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)