Info

Login

Channels

APIs

Credits

  • cheeser
  • ernimril
  • joed
  • kinabalu
  • lunk
  • ojacobson
  • r0bby
  • ThaDon
  • ricky_clarkson
  • topriddy

« 2019-11-09

2019-11-10

2019-11-11 »

Nick Message Date
ChaiTRex locustlord: You can pass the HashMap into methods if you want to. [12:00]
locustlord how do I do that? [12:01]
ChaiTRex locustlord: Make one of the parameters: HashMap<whatever, whatever> variableName [12:02]
ChaiTRex locustlord: Then variableName or whatever you named it is usable in the method. [12:02]
Anthaas [Anthaas!~Anthaas@unaffiliated/anthaas] has joined ##java [12:02]
ChaiTRex locustlord: Works like any other method parameter. [12:03]
Chuguniy [Chuguniy!~Chuguniy@home-136.169.20.159.mits.lv] has joined ##java [12:07]
tracks [tracks!~tracks@2600:1700:ade0:4400:cc20:6bb8:8c71:b206] has joined ##java [12:09]
nokdoot [nokdoot!~nokdoot@211.205.207.39] has joined ##java [12:14]
Chuguniy [Chuguniy!~Chuguniy@home-136.169.20.159.mits.lv] has joined ##java [12:15]
locustlord how do I convert an int to a char? [12:19]
ChaiTRex locustlord: Do you mean an int to a String or to a char? [12:20]
ChaiTRex locustlord: Both can be done, but they do different things. [12:20]
locustlord char [12:20]
locustlord I did say char [12:20]
ChaiTRex locustlord: In that case, you can cast it with: (char) intValue [12:21]
locustlord "cannot cast from integer to char" [12:21]
cheeser show us [12:22]
cheeser Paste the code (and any errors) in a pastebin where we can see it. See ~pastebin for options. Also see ~testcase for good examples as to how to help us help you quickly diagnose and solve problems. [12:22]
locustlord "tokens[i] = (char) hash.get(i);" [12:22]
locustlord where tokens is a char array [12:23]
ChaiTRex locustlord: In the case of Integer, you need to convert from Integer to int with integerValue.intValue(). You can then cast that with (char) on front. [12:23]
locustlord ah ok [12:23]
locustlord that works [12:23]
locustlord ok I don't get why I'd be getting a nullpointerexception here [12:26]
locustlord since everything is defined properly [12:26]
locustlord https://glot.io/snippets/fhpl8ha26a [12:26]
locustlord I'm not pointing to a null value [12:27]
cheeser yes you are [12:27]
ChaiTRex locustlord: What line are you getting it on? [12:27]
locustlord 15 [12:27]
cheeser npe [12:27]
cheeser locustlord, NullPointerExceptions are easy to spot and deal with. For some tips on dealing with them, please see https://is.gd/bYdbFp [12:27]
ChaiTRex locustlord: OK, then something in front of a . is null. [12:28]
ChaiTRex locustlord: hash might be. hash.get(i) might be. [12:28]
cheeser almost certainly is [12:28]
locustlord hash.get(i) is what I looked at first [12:28]
locustlord but looking at espresso.txt there's no reason it should be [12:28]
locustlord since y is not null [12:29]
ChaiTRex locustlord: Insert a line above 15 and println out hash and hash.get [12:29]
ChaiTRex (i) [12:29]
cheeser save it to a var. look at it. [12:29]
cheeser read the link. [12:29]
cheeser NPEs are super easy to fix. [12:29]
locustlord ok it is hash.get(i) [12:30]
locustlord but I don't understand why it is [12:30]
cheeser there's nothing in that map with that key [12:30]
ChaiTRex locustlord: Well, you can take a look at what i is and what keys are defined for hash. [12:30]
locustlord there is though [12:30]
cheeser there isn't though. [12:30]
locustlord well [12:30]
locustlord should be [12:30]
locustlord there isn't as I can see [12:31]
cheeser the jvm is rarely wrong [12:31]
locustlord it's also in conflict with me actually printing h at the end [12:31]
locustlord because when I print h it does print y=3 [12:31]
locustlord so I'm a bit confused, the jvm seems to be contradicting itself [12:32]
cheeser it's not [12:32]
ChaiTRex locustlord: What's i set to on line 15? [12:32]
locustlord 0, at the start [12:34]
locustlord but it's not in the alphabet [12:34]
locustlord so when it actually runs line 15 it's set to y [12:34]
ChaiTRex locustlord: OK, do you have the Integer 0 as a key isn hash? [12:35]
locustlord no [12:35]
locustlord but it's an if statement [12:35]
locustlord so that shouldn't matter [12:35]
cheeser how can an int be set to y? [12:35]
locustlord it's not [12:36]
ChaiTRex locustlord: Here's the javadoc for HashMap#get: https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#get-java.lang.Object- [12:36]
locustlord y is a char [12:36]
locustlord it's a hashmap [12:36]
cheeser enter [12:36]
cheeser Enter is not punctuation. Please don't press your Enter or Return key until you're finished typing your question, sentence, or idea. It is annoying to see that and hard to follow. [12:36]
ChaiTRex locustlord: Right, the HashMap's keys are Strings, right? [12:36]
cheeser i'm surprised this eve compiles [12:36]
locustlord OH [12:36]
locustlord I need to convert tokens at i to a string [12:37]
locustlord duh [12:37]
ChaiTRex locustlord: HashMap#get, according to its documentation, returns null every single time you try to get something that's not a key in the map. [12:37]
ChaiTRex locustlord: So, when you see that the docs for the method say it returns null when this and this and this, you can know what's going on a bit better. [12:38]
nb-ben imagine how hard it would have been to use a hashmap if this worked [12:38]
locustlord normally I'd agree I was being stupid [12:38]
locustlord but in this case I think it's the jvm's fault for not just saying can't convert types [12:38]
cheeser it's not a type conversion problem. [12:39]
cheeser if it were that, it'd fail at compile time. that happens all the time. [12:39]
ChaiTRex locustlord: It's not the JVM, it's HashMap. put checks types. get doesn't (accepts Object argument rather than K type argument). [12:40]
wreed [wreed!~wreed@2601:645:8100:8480:85dd:7f60:d50a:9556] has joined ##java [12:40]
cheeser that's right. i forgot about that wart. [12:40]
ChaiTRex locustlord: Probably a design mistake, but I don't know the thoughts that went into it. [12:41]
cheeser it's a backwards compatibility thing. Map long predates generics. updating get() to take a K would break a lot of code [12:43]
ChaiTRex Ahh, OK [12:43]
KeyJoo [KeyJoo!~KeyJoo@83.220.181.139] has joined ##java [12:43]
nb-ben I think I've read somewhere it's related to Object#equals contracts [12:43]
nb-ben where two objects may not be relatives but still be equal [12:44]
cheeser ... [12:44]
nb-ben so let's say you designed your system with poor taste and you have UserInfo and UserData and they only compare the user ID for equals and only compute their hashcode based on userid, you could use them interchargeably for Map#get [12:47]
locustlord ok why doesn't String i = String.valueOf(tokens[i]); work [12:48]
cheeser doesn't work [12:48]
cheeser locustlord, doesn't work is useless. Tell us what it is, what you want it to do, and what it is doing. Consider putting some code and any errors on a pastebin. (use ~pastebin for suggestions) [12:48]
cheeser nb-ben: i can see that [12:48]
locustlord nvm [12:48]
cheeser it was complaining about reusing the i name wasn't it? [12:48]
locustlord huh bot doesn't work [12:50]
locustlord ese [12:50]
locustlord locustlord, what does that even *mean*? [12:50]
ham [ham!~z0mbie@unaffiliated/ragnarokkr] has joined ##java [12:50]
nb-ben locustlord: nothing seems to work for you today [12:50]
locustlord emptystackexception [12:50]
locustlord locustlord, what does that even *mean*? [12:50]
locustlord great it only works for cheeser [12:50]
cheeser mock locustlord [12:50]
cheeser locustlord you're going to live a long life. https://www.washingtonpost.com/science/2019/10/16/excessive-brain-activity-linked-shorter-life/ [12:50]
locustlord EmptyStackException [12:50]
locustlord locustlord, what does that even *mean*? [12:50]
cheeser EmptyStackException [12:51]
cheeser cheeser, what does that even *mean*? [12:51]
ChaiTRex javadoc EmptyStackException [12:51]
ChaiTRex ChaiTRex: http://bit.ly/2qD6w6Z [JDK: java.util.EmptyStackException] [12:51]
cheeser see? it doesn't know wtf you're talking about [12:51]
tassee [tassee!~tasse@55d4a178.access.ecotel.net] has joined ##java [12:56]
locustlord ok [12:59]
locustlord I've come to no conclusion about why the stack would be empty [01:00]
locustlord in fact [01:00]
locustlord it's contradictory [01:00]
locustlord because the very line where the exception happens is after a loop saying while (!ops.empty()) [01:00]
kicked locustlord (enter is not punctuatoin) [01:01]
locustlord [locustlord!~tech@S0106f0f249e2c023.va.shawcable.net] has joined ##java [01:01]
locustlord sorry [01:01]
ChaiTRex locustlord: you pop twice after that [01:02]
ChaiTRex locustlord: Three times, actually, now that I look closer. [01:02]
locustlord ChaiTRex, I don't see the third [01:10]
ChaiTRex locustlord: You have three arguments to applyOp. All of them pop. [01:10]
locustlord I don't see the third argument [01:11]
ChaiTRex locustlord: One or more of those fails because its stack is empty. The question is which one. [01:11]
Nicmavr [Nicmavr!~Nicmavr@unaffiliated/nicmavr] has joined ##java [01:11]
locustlord it's the one outside the for loop [01:11]
locustlord at least that's what jvm says [01:11]
ChaiTRex locustlord: Here: values.push(applyOp(ops.pop(), values.pop(), values.pop())); [01:12]
ChaiTRex locustlord: Check the size of ops and values at each iteration before you do that. [01:12]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [01:20]
wreed [wreed!~wreed@2601:645:8100:8480:85dd:7f60:d50a:9556] has joined ##java [01:22]
locustlord is there a way to set it to debug line by line the way you can with gdb/ [01:22]
locustlord ? [01:22]
locustlord in eclipse [01:23]
tracks [tracks!~tracks@2600:1700:ade0:4400:e503:a69b:c59a:5a4] has joined ##java [01:23]
nb-ben that's a googlable question [01:27]
nfd9001 [nfd9001!~nfd9001@c-67-183-33-240.hsd1.wa.comcast.net] has joined ##java [01:34]
ham [ham!~z0mbie@unaffiliated/ragnarokkr] has joined ##java [01:39]
ham [ham!~z0mbie@unaffiliated/ragnarokkr] has joined ##java [01:50]
acidjnk_new2 [acidjnk_new2!~acidjnk@200116b867e210006d5a43f86874d782.dip.versatel-1u1.de] has joined ##java [01:51]
nav2002 [nav2002!~nav2002@115.99.28.188] has joined ##java [01:52]
jaziz1 [jaziz1!~jaziz@unaffiliated/jaziz] has joined ##java [01:54]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [01:57]
veegee [veegee!~veegee@ipagstaticip-3d3f7614-22f3-5b69-be13-7ab4b2c585d9.sdsl.bell.ca] has joined ##java [01:58]
shantaram [shantaram!uid207478@gateway/web/irccloud.com/x-hpqgwrmziqonhlmh] has joined ##java [02:03]
locustlord could someone take a look at this [02:10]
locustlord I'm at a loss [02:10]
locustlord https://glot.io/snippets/fhpo3snmh0 [02:10]
palasso [palasso!~palasso@unaffiliated/palasso] has joined ##java [02:10]
locustlord it should grab the value for y and assign it to charray[i] [02:11]
db [db!uid18678@gateway/web/irccloud.com/x-gypwpdjvaxivrtzc] has joined ##java [02:11]
locustlord and then function the way it does as if there's no letter [02:11]
mckid [mckid!~Cryptikul@qubcpq0957w-lp140-01-76-64-187-209.dsl.bell.ca] has joined ##java [02:13]
nfd9001 [nfd9001!~nfd9001@c-67-183-33-240.hsd1.wa.comcast.net] has joined ##java [02:20]
fafenboy [fafenboy!3c705af4@softbank060112090244.bbtec.net] has joined ##java [02:20]
magyar [magyar!~magyar@unaffiliated/magyar] has joined ##java [02:33]
mckid [mckid!~Cryptikul@qubcpq0957w-lp140-01-76-64-187-209.dsl.bell.ca] has joined ##java [02:33]
juhwad__ [juhwad__!~jaziz@unaffiliated/jaziz] has joined ##java [02:37]
rajrajraj [rajrajraj!uid72176@gateway/web/irccloud.com/x-hqpitruskxcjzohl] has joined ##java [02:43]
sdu [sdu!~doo@80.107.19.72] has joined ##java [02:48]
fstd_ [fstd_!~fstd@unaffiliated/fisted] has joined ##java [02:57]
locustlord thank you guys for all your help [03:13]
locustlord parted the channel: "Leaving" [03:14]
minos_ [minos_!~simonbosm@137-152-21-31.ftth.glasoperator.nl] has joined ##java [03:16]
nfd9001 [nfd9001!~nfd9001@c-67-183-33-240.hsd1.wa.comcast.net] has joined ##java [03:29]
minos_ [minos_!~simonbosm@137-152-21-31.ftth.glasoperator.nl] has joined ##java [03:33]
immibis [immibis!~immibis@p200300F1C70F8876B5C31538399FB543.dip0.t-ipconnect.de] has joined ##java [03:48]
immibis_ [immibis_!~immibis@p200300F1C70F887669B4F29DF4959B29.dip0.t-ipconnect.de] has joined ##java [03:48]
tracks [tracks!~tracks@2600:1700:ade0:4400:fc22:e742:2585:cea5] has joined ##java [03:53]
ham [ham!~z0mbie@unaffiliated/ragnarokkr] has joined ##java [04:01]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [04:07]
rippa [rippa!~rippa@ppp-vpdn-37.1.85.157.yarnet.ru] has joined ##java [04:18]
sa02irc [sa02irc!~mbax@155-079-043-212.ip-addr.inexio.net] has joined ##java [04:21]
adder [adder!~adder@gateway/tor-sasl/adder] has joined ##java [04:31]
seli [seli!~seli@81-236-184-212-no272.tbcn.telia.com] has joined ##java [04:35]
dob1 [dob1!~dob1@unaffiliated/dob1] has joined ##java [04:36]
con3 [con3!~kvirc@154.119.40.183] has joined ##java [04:37]
KeyJoo [KeyJoo!~KeyJoo@83.220.181.139] has joined ##java [05:06]
Gazooo [Gazooo!~Gazooo@142.196.183.136] has joined ##java [05:08]
ArcherL [ArcherL!01ba9c06@unaffiliated/archerl] has joined ##java [05:14]
adder [adder!~adder@gateway/tor-sasl/adder] has joined ##java [05:17]
CookieM [CookieM!~tomek@afba120.neoplus.adsl.tpnet.pl] has joined ##java [05:22]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [05:24]
sizeof_void34 [sizeof_void34!~dolbean@2a00:1370:811e:d659:cc56:1d69:2f29:f6ea] has joined ##java [05:31]
Hanii [Hanii!~Hanii@2a00:23c5:c587:a800:3882:a732:dac1:32ae] has joined ##java [05:32]
rruizt [rruizt!~rruizt@83-84-23-124.cable.dynamic.v4.ziggo.nl] has joined ##java [05:36]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [05:36]
lightslategrey [lightslategrey!~lightslat@94.180.141.123] has joined ##java [05:39]
KeyJoo [KeyJoo!~KeyJoo@83.220.181.139] has joined ##java [05:39]
lightslategrey Hi. python `shelve` module allows to persist and retrieve objects from disk with just one line of code and just one line of setup code. [05:43]
lightslategrey import shelve; shlv = shelve.open('filename'); shlv['test_key_1'] = 5; print(shlv['test_key_1']) [05:43]
acidjnk_new [acidjnk_new!~acidjnk@200116b867e21000f10be86dd14b2c69.dip.versatel-1u1.de] has joined ##java [05:43]
lightslategrey Is there anything like that for Java? [05:43]
yawkat jackson [05:45]
yawkat Jackson is a library that provides a streaming parser for many, many common dataformats (including ~XML, ~JSON, ~YAML, ~CSV, and others) and can map those formats into and from Java Objects as well. See https://github.com/FasterXML/jackson - it's probably the most common such library in use in Java today. [05:45]
yawkat (added benefit of not being a security mess) [05:46]
KeyJoo [KeyJoo!~KeyJoo@83.220.181.139] has joined ##java [05:47]
lightslategrey yawkat, it just serialises and deserialises things. In contrast, shelve adds more convenience on top of serialisation. [05:49]
VegetarianFalcon [VegetarianFalcon!uid258908@gateway/web/irccloud.com/x-gluupsmlutfxiztz] has joined ##java [05:54]
VegetarianFalcon parted the channel: [06:08]
paddyez [paddyez!~Patrick-E@wikipedia/paddyez] has joined ##java [06:11]
ravenousmoose [ravenousmoose!~ravenousm@ptr-d6zu298ko5cgaues4lk.18120a2.ip6.access.telenet.be] has joined ##java [06:17]
minos_ [minos_!~simonbosm@137-152-21-31.ftth.glasoperator.nl] has joined ##java [06:28]
somazero [somazero!~somazero@2600:8805:100:112:46a5:39e4:32f6:d475] has joined ##java [06:37]
xa0s_ [xa0s_!xa0s@ma.sdf.org] has joined ##java [06:56]
makara1 [makara1!~sol@196.61.111.63] has joined ##java [06:59]
adadelta I feel like I'm not approaching something correctly, thought I'd throw it out here. I have a factory pattern that is returning immutable objects with set fields, e.g. returns Volvo, Ferrari, Hundayi etc. that are totally immutable. Something feels odd about this [07:03]
adadelta maybe it isn't though [07:03]
adadelta maybe using multiple value enums would be 'nicer' [07:03]
adadelta anyone have any tips? [07:03]
ernimril adadelta, You have not told us enough about what you are trying to do so currently impossible to give any advice [07:04]
deathcap [deathcap!~user@unaffiliated/deathcap] has joined ##java [07:05]
sponge337 [sponge337!~sponge337@unaffiliated/sponge337] has joined ##java [07:12]
sponge337 Hello, I am searching for an old package for openjdk on found it on https://www.pkgs.org. Is this a legit site to download? [07:12]
HumanG33k [HumanG33k!~HumanG33k@62.147.242.8] has joined ##java [07:14]
ravenousmoose [ravenousmoose!~ravenousm@ptr-d6zu298ko5cgaues4lk.18120a2.ip6.access.telenet.be] has joined ##java [07:20]
extor [extor!~extor@unaffiliated/extor] has joined ##java [07:20]
Lengsdorfer [Lengsdorfer!~Lengsdorf@unaffiliated/lengsdorfer] has joined ##java [07:31]
indistylo [indistylo!~aruns_@106.51.21.67] has joined ##java [07:47]
kicked indistylo (Banned: please fix your connection. you're bouncing in and out. this ban will expire after 7d) [07:47]
Hatsjoe [Hatsjoe!~Hatsjoe@unaffiliated/hatsjoe] has joined ##java [07:54]
dreamreal sponge337: why not get it from adoptopenjdk? [08:10]
dreamreal lightslategrey: well, there's absolutely nothing preventing you from writing convenience methods that lock you into serialization to and from a filename [08:11]
ravenousmoose [ravenousmoose!~ravenousm@ptr-d6zu298ko5cgaues4lk.18120a2.ip6.access.telenet.be] has joined ##java [08:24]
con3 [con3!~kvirc@154.119.40.183] has joined ##java [08:26]
nav2002 [nav2002!~nav2002@115.99.223.196] has joined ##java [08:32]
Ashley55 [Ashley55!18956603@24.149.102.3] has joined ##java [08:38]
ipe [ipe!~ipe@91-156-247-55.elisa-laajakaista.fi] has joined ##java [08:40]
gelignite [gelignite!~gelignite@55d44eba.access.ecotel.net] has joined ##java [08:43]
Ashley55 Hello! I was wondering if someone could help me fix some code. I'm extremely tired and cannot think straight xD [08:50]
deathcap Well, that's a very broad inquiry. [08:51]
sonOfRa Easy fix, get to sleep, fix code after sleeping. [08:51]
dreamreal Ashley55: no, as we've not seen the code or problem description. Get some sleep. [08:51]
dreamreal doesn't work [08:52]
dreamreal Ashley55, doesn't work is useless. Tell us what it is, what you want it to do, and what it is doing. Consider putting some code and any errors on a pastebin. (use ~pastebin for suggestions) [08:52]
Maxdamantus [Maxdamantus!~Maxdamant@unaffiliated/maxdamantus] has joined ##java [08:55]
dreamreal sonOfRa ++ you did it! [08:56]
dreamreal sonofra has a karma level of 169, dreamreal [08:56]
Ashley55 I was just trying to see if someone was active that's why I havent't posted anything. This is just the main jist of it. https://pastebin.com/z4Q0ZQQ5 I'm trying to delete all duplicate nodes. Such as 8 [08:57]
Ashley55 I have no clue why it indented like that either >_< [08:58]
dreamreal why would you A) use a linked list, B) not use a Set, C) not pose the actual problem you're having, like what you tried and what happened [08:59]
dreamreal and D) this is homework, get some sleep and fix it tomorrow [08:59]
dreamreal sonOfRa -- you didn't fix it [08:59]
dreamreal sonofra has a karma level of 168, dreamreal [08:59]
dreamreal sonOfRa ++ you gave the right advice to fix it [08:59]
dreamreal sonofra has a karma level of 169, dreamreal [08:59]
dreamreal D [08:59]
Ashley55 Fair enough, I'm just struggling with college and life xD. Good night yall even though its 9:00 am for me xD [09:00]
EgonX [EgonX!~Egon@2601:2c6:47f:98f4:b03b:101e:e9bc:a0e2] has joined ##java [09:00]
deathcap isn't EST a great time zone? [09:01]
learningc [learningc!~pi@121.122.85.107] has joined ##java [09:01]
deathcap dreamreal I'd say the answer to A is "cause this data structures class is more concerned with proving a point than being practical" [09:03]
hammond in git what can you .gitignore in a maven project and still have it work if someone pulled it? like .project/.classpath. I'm using eclipse btw [09:10]
nova99 [nova99!~thelounge@167.71.49.78] has joined ##java [09:13]
nova99 Hi, dates are giving me headaches again [09:13]
deathcap which kind of dates [09:14]
nova99 I'm trying to store an instant object in mysql using hibernate + spring boot [09:14]
nova99 keeps giving me sql syntax error [09:14]
deathcap annnnd i'm out. [09:14]
nova99 ( [09:15]
nova99 may i ask why? [09:15]
deathcap Cause I barely know anything about hiberate and spring. [09:15]
nova99 Oh okay [09:16]
deathcap That being said, what's the sql error? [09:16]
nova99 That's the thing, it's vague [09:16]
deathcap So is that answer. What does it say? [09:16]
nova99 Just give me a moment, sorry [09:16]
deathcap Okie dokie. I may not be able to help, but there are plenty of people here who will give you a lot of grief for not getting to the point asap. :) [09:17]
nova99 ahaha it suddenly started working rofl [09:18]
dreamreal hammond: .project, .classpath, .idea, *.iml, *.ipr, target/, build/ [09:18]
deathcap You did it! Somehow. [09:18]
dreamreal nova99: next time, say what the problem actually is instead of dancing. You ain't Michael Jackson. [09:18]
dob1 he is dead :/ [09:18]
dreamreal Glad you sorted it out, though. [09:18]
dreamreal dob1: more reason that nova99 isn't michael jackson, no? [09:19]
dob1 true [09:19]
nova99 dreamreal: thing is i typed the query twice then kept deleting it because i wasn't sure if it was correct or not [09:19]
dreamreal nova99: well, that NORMALLY is an excellent way to make as little progress as possible, but good for you! [09:19]
nova99 next time i tried to verify it, it started working [09:19]
deathcap I'll never forget the day I heard that Michael Jackson died. I was sitting in the park with my friends Ronnie and Aaron. Ronnie was temporarily homeless and sleeping there, and we were having this deep heart-to-heart about our goals in life, aspirations, dreams, etc. Then somebody nearby just screams "OH MY GOD, DID YOU HEAR MICHAEL JACKSON DIED". It kind of...ruined the moment. [09:20]
dob1 it was a big news [09:21]
nova99 parted the channel: "The Lounge - https://thelounge.chat" [09:21]
deathcap Prince bummed me out a lot more, if we're gonna talk dead 80s icons. [09:22]
dreamreal Hey, I have an idea, this is ##java, let's get back on topic! [09:22]
deathcap dreamreal party pooper. but yeah, you're right, enough mj. [09:23]
dob1 dreamreal, so jackson library is not based on him ? [09:23]
darkxploit [darkxploit!~jay@c-73-68-48-243.hsd1.ct.comcast.net] has joined ##java [09:23]
ogradyd [ogradyd!~Thunderbi@2a02:8070:88bf:9df0::577] has joined ##java [09:34]
Arlion [Arlion!Arlion@gateway/vpn/privateinternetaccess/arlion] has joined ##java [09:41]
surial dob1: no. [09:41]
bravoslo [bravoslo!~bravo@178.162.204.214] has joined ##java [09:42]
emmanuelux [emmanuelux!~emmanuelu@2a01cb0000f39300cd8dd57c3517c111.ipv6.abo.wanadoo.fr] has joined ##java [09:44]
oakridge [oakridge!~oakridge@190.210.155.104.bc.googleusercontent.com] has joined ##java [09:46]
Xe4roX [Xe4roX!~Xe4roX@unaffiliated/xe4rox] has joined ##java [09:47]
presiden jackson [09:48]
presiden Jackson is a library that provides a streaming parser for many, many common dataformats (including ~XML, ~JSON, ~YAML, ~CSV, and others) and can map those formats into and from Java Objects as well. See https://github.com/FasterXML/jackson - it's probably the most common such library in use in Java today. [09:48]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [09:53]
alexi5 [alexi5!~alexi5@38.92.125.177] has joined ##java [09:56]
alexi5 hello [09:56]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [09:57]
alexi5 in modern web application development, is JSF still being used for new projects ? [09:57]
cheeser yes but it's less common [09:58]
alexi5 what is typical used inplace of JSF nowadays ? [10:00]
surial alexi5: I don't think there's a single answer to that. There's dropwizard, spring's various offerings, a template-free all-ajax framework (usually angular or vue.js or whatnot).... [10:00]
alexi5 ok, was just curious as to what is out there :) [10:01]
alexi5 I have used JSP and move on to using Thymleaf and spring [10:02]
alexi5 and was just curious about what else is there [10:02]
surial alexi5: Just going off of wikipedia, there's one rebuttal to various criticisms for JSF, and it reads: "JSF is a stateful framework by nature and state makes web applications easy to develop with. With improved state management techniques introduced in JSF 2.0+ (e.g. stateless mode, partial state saving), JSF can scale as well." [10:03]
surial HTTP is rather fundamental in how it is stateless, and I can point you at half a million blogs explaining that bending over backwards to introduce state into the HTTP session itself is the source of most of your problems. Which seems to suggest that both the complexity and the attempt to smash the square peg that is HTML/CSS/JS into the round hole that is JSF/stateful, is a big part of the problem. [10:04]
surial But then again, I believe stuff like vue and angular and co are also stateful so what the hell do I know. I still write my webapps with templates (velocity, no less), and additive JS, and doing great. Maybe I don't know what I'm missing. [10:05]
ravenousmoose [ravenousmoose!~ravenousm@ptr-d6zu298ko5cgaues4lk.18120a2.ip6.access.telenet.be] has joined ##java [10:07]
alexi5 so I guess it comes down to, do what gets the job done ? :) [10:07]
mluser-home [mluser-home!~mluser-ho@ip68-0-67-199.tu.ok.cox.net] has joined ##java [10:11]
mluser-home [mluser-home!~mluser-ho@ip68-0-67-199.tu.ok.cox.net] has joined ##java [10:14]
waz and what the job is [10:16]
cheeser protocols are, in general, "stateless" so HTTP being stateless is not unique. the same problems would exist with almost any other protocol. [10:21]
ricpf [ricpf!~ricpf@2804:14c:43:8465:3f6d:f756:35f9:9ecc] has joined ##java [10:23]
ricpf [ricpf!~ricpf@2804:14c:43:8465:3f6d:f756:35f9:9ecc] has joined ##java [10:32]
con3 [con3!~kvirc@154.119.40.183] has joined ##java [10:35]
con3 [con3!~kvirc@154.119.40.183] has joined ##java [10:37]
dob1 I have a list with a comparable field and a defined value. I want to split the list in 2 based on this field: a list of objects who field value is less eq than the defined value and the rest. What is a good way to do this ? the for loop iterating the items and building the 2 lists? [10:44]
dob1 it's seem the more simpler [10:45]
deathcap i'd do this. https://pastebin.com/jptaRFuF [10:49]
sonOfRa dob1: do you have duplicates? If not, the SortedSet interface has headSet and tailSet [10:50]
sonOfRa So if you don't have duplicates, cram your data into a SortedSet instance (treeset most likely), and call headSet(item) to get items that are stricly less than item, and tailSet(item) to get a set that is greater than or equal to item [10:51]
deathcap sonOfRa's solution also works. Mine's assuming we're dealing with a number. Otherwise you'd need to change my inequality lambda to a compareTo call and modify it accordingly, but you get the gist. [10:53]
sonOfRa dob1: if you have Guava, you can also use SortedMultiSet if you have duplicates [10:58]
dob1 I take a look at your hints, thanks [11:03]
dob1 no duplicates [11:04]
sdu [sdu!~doo@80.107.19.72] has joined ##java [11:13]
lightslategrey Is there any way in java to pass reference to the field of object? [11:23]
Maldivia lightslategrey: not directly [11:23]
Maldivia lightslategrey: you have indirections through lambdas, VarHandle, Reflection, etc [11:24]
Maldivia lightslategrey: what are you trying to do? [11:24]
lightslategrey lambdas and reflection would overkill to my case. I wanted something concise and simple. [11:25]
Maldivia how is lambda overkill ? [11:25]
yawkat "pass by reference" and "simple" :D [11:26]
lightslategrey Maldivia, because it would look ugly and would compilcate understanding of code by the reader. [11:26]
[twisti] lightslategrey: what you want to do is basically discouraged by the language [11:26]
[twisti] thats why all the solutions are so 'ugly' [11:26]
Maldivia lightslategrey: accessor methods then (getters/setters) -- it's the idiomatic way in Java [11:27]
lightslategrey Maldivia, I wanted to pass the reference to a field of object so the callee method would be able to write result to this field. [11:27]
Maldivia lightslategrey: then pass a Consumer<T> instead [11:27]
[twisti] lightslategrey: give them an instance of the object and let them use the setter [11:27]
deathcap foo::setField [11:27]
wreed [wreed!~wreed@2601:645:8100:8480:85dd:7f60:d50a:9556] has joined ##java [11:28]
Maldivia Consumer<T> is the nice way of doing it, you need to wrap it into a reference type anyway -- then the actual implementation of it can be whatever -- and it's a functional interface, so a easy for a lambda [11:28]
ham [ham!~z0mbie@unaffiliated/ragnarokkr] has joined ##java [11:29]
Maldivia void doSomething(Consumer<T> putResultHere) { ...: putResultHere.accept(result); } [11:29]
Maldivia doSomething(v -> this.field = v); [11:29]
Maldivia I don't see how that is ugly [11:29]
lightslategrey Maldivia, Side note: I don't care much about this "non-idiomatic" and "discouraged". Programmers should not be stupid trained monkeys following practices they told by someone "because everyone do this". In some cases some solutions look more appropriate than others, thus programmer should use what he fells would be better. [11:31]
Maldivia lightslategrey: side note: I don't care [11:32]
lightslategrey Maldivia, maybe it's not that ugly. But I thought maybe there is something like & (address of basically), seems it's not the case. [11:34]
lightslategrey Maldivia, I don't care about your opinion either [11:34]
Maldivia there are no pointers in Java [11:34]
Maldivia next [11:34]
Maldivia Another satisfied customer. Next! [11:34]
[twisti] lightslategrey: generally there are good reason deliberated by pretty smart people why people do things the way they are done idiomatically. certainly there are exceptions, but as a novice to programming in general and/or a specific language, its generally a good idea to go with the idiomatic way by default, if not as an iron rule [11:36]
[twisti] its the way people often say 'if you hear hooves, think horse, not zebra'. its not that there are never zebras, but there are just a lot more horses, so if you go with the default idiomatic solution then you will have picked the right/a good solution a lot more often than not [11:37]
surial lightslategrey: The answer is a simple no. You cannot pass fields as references in java. Period. No ifs or buts about it. All the nearest alternatives that were explained to you were disregarded, in an asshole kinda way, by you - and those WERE the nearest equivalents. Thus: No. Final answer. [11:37]
somazero [somazero!~somazero@2600:8805:100:112:cbb5:3a7e:e144:4f17] has joined ##java [11:39]
rohanrhu_ [rohanrhu_!~rohanrhu@78.181.238.50] has joined ##java [11:39]
xeno [xeno!~xeno@unaffiliated/xeno] has joined ##java [11:40]
somazero [somazero!~somazero@2600:8805:100:112:cbb5:3a7e:e144:4f17] has joined ##java [11:40]
con3 [con3!~kvirc@154.119.40.183] has joined ##java [11:41]
Bombe The foot is down, I repeat, the foot is down! [11:44]
surial Bombe: what are you on about? [11:44]
darkxploit [darkxploit!~jay@c-73-68-48-243.hsd1.ct.comcast.net] has joined ##java [11:44]
Bombe Oh, nothing, nothing, don?t mind me. [11:45]
ravenousmoose [ravenousmoose!~ravenousm@ptr-cud5aqffzafjlm1cu03.18120a2.ip6.access.telenet.be] has joined ##java [11:46]
mizi [mizi!~mizi@p200300ECF3CBB400F1FD9E6C6CD33B2A.dip0.t-ipconnect.de] has joined ##java [11:48]
Nicmavr [Nicmavr!~Nicmavr@unaffiliated/nicmavr] has joined ##java [11:51]
lightslategrey twisti: I don't agree. Neither in regard to novice programmer nor experienced. Sure in many cases there are some reasons behind this. But generally it turns into people just following group-think without really understanding why something is discouraged and whether it's bad at all. There many examples of this but I can't really recollect them right now. This includes praise of unit-testing, prohibition of goto and global variables amongst other [11:52]
lightslategrey things. Some of these doesn't applicates to expirienced programmers and I don't believe would help any novices. As of smart people: they make mistakes too, sometimes they experience is too specific, they have they own tastes and what applicates to them is not always true for other people. [11:52]
somazero [somazero!~somazero@2600:8805:100:112:cbb5:3a7e:e144:4f17] has joined ##java [11:53]
Jantz [Jantz!~IceChat9@2407:7000:8d04:100:81e4:6391:5c82:1ad9] has joined ##java [11:56]
kp__ [kp__!~kp@pool-72-83-231-45.washdc.fios.verizon.net] has joined ##java [11:56]
atslash [atslash!~atslash@static.231.107.9.5.clients.your-server.de] has joined ##java [11:57]
yawkat https://s.yawk.at/qqAQXfk6 [11:58]
shrewdy [shrewdy!~shrewdy@2a03:2880:11ff:21::face:b00c] has joined ##java [12:00]
royal_screwup21 [royal_screwup21!89de72f4@gateway/web/cgi-irc/kiwiirc.com/ip.137.222.114.244] has joined ##java [12:01]
somazero [somazero!~somazero@2600:8805:100:112:cbb5:3a7e:e144:4f17] has joined ##java [12:04]
surial lightslategrey: as an example, take the java communities generally-agreed-upon rules on identifiers: variableName, TypeName, CONSTANT_NAME, package.name. [12:08]
surial lightslategrey: java the language doesn't care. If you want to python-style it and go with variable_name, you can. If you want to go with C# and do MethodName and typeName instead of the other way around, you can. [12:09]
surial lightslategrey: Now, maybe it's better. Certainly underscore-based is also quite popular (SQL, JS, python, ruby, PHP (though there it feels like a clusterfuck of inconsistency)). Let's say that there is some small benefit to it, and you want everybody to think about it and not just mindlessly follow the herd. [12:10]
xeno [xeno!~xeno@unaffiliated/xeno] has joined ##java [12:10]
surial lightslategrey: that seems, with all due respect, fucking stupid to me. For starters, breaking the mold means that you have a hard time reading the code of others, and others will have a hard time reading your code. VERY FEW programmers are solitary: Your code WILL be read by others, and you will WILL need to read the code of others. [12:10]
Goplat [Goplat!~Goplat@reactos/developer/Goplat] has joined ##java [12:11]
surial lightslategrey: So, breaking the mold? It doesn't come cheap. Yes, you should keep an open mind and where relevant consider your options. But is the way you write this stuff particularly likely to be such a remarkable change if you pick anything else? I'd say the right choice is to BLINDLY FOLLOW THE HERD: It is NOT worth wasting precious time researching or trying other things, let alone the cost of being different in this [12:11]
surial regard. [12:11]
surial That's not a formula to say that any breaking of any molds is necessarily bad. But, if you wanna break the mold, consider the costs, and come well prepared with solid arguments and a theory as to why it ought to be broken. If you don't have any of that, you're.. mostly being contrarian 'just cuz', or that's what it feels like. [12:12]
neckutrek [neckutrek!54d8ce35@gateway/web/cgi-irc/kiwiirc.com/ip.84.216.206.53] has joined ##java [12:12]
surial Going back to your specific idea of passing fieldrefs around: Fun idea. Might be interesting. But java doesn't let you. Period. [12:12]
EgonX [EgonX!~Egon@2601:2c6:47f:98f4:b13a:8958:2748:bf8d] has joined ##java [12:31]
oogaw [oogaw!~wagoo@105.153.198.178.dynamic.wline.res.cust.swisscom.ch] has joined ##java [12:32]
royal_screwup21 [royal_screwup21!89de72f4@gateway/web/cgi-irc/kiwiirc.com/ip.137.222.114.244] has joined ##java [12:32]
EgonX [EgonX!~Egon@2601:2c6:47f:98f4:70aa:5f6:301e:c35d] has joined ##java [12:38]
rruizt [rruizt!~rruizt@83-84-23-124.cable.dynamic.v4.ziggo.nl] has joined ##java [12:38]
dueyfinster [dueyfinster!~dueyfinst@79.97.44.27] has joined ##java [12:44]
Aquazi [Aquazi!uid312403@gateway/web/irccloud.com/x-gtpqeagzzjglihaq] has joined ##java [12:50]
lightslategrey surial, [12:50]
lightslategrey surial, Look. I work on this project to about year as single developer. There are things like single code-base for android and Java, some minor parts of standard library being abstract and supplemented to compile and work under either evironments, there is some lua integration tricks to not leak memory, there is some tricky android open-gl stuff was really hard to get (I only saw one project doing that), bunch scripts, code I implemented as JNI [12:50]
lightslategrey have to compile and work under two environments, some algorithms to meet sub-second constraints, custom OS build with some minor pathes, lots of thing, let along gradle setup for modular+nonmodular code. In the event of other developer working on this, I sure he would be able to easily delve into and be productive. Maybe there would be some things require him to spend some time. But underscores in my variables? Or other "non-idiomatic" stuff? It [12:50]
lightslategrey doesn't really matter, that's the least thing that makes any difference. You must be kidding. [12:50]
satifant [satifant!~sati@unaffiliated/satifant] has joined ##java [12:52]
lightslategrey surial, As of passing actual reference to fields. I only face the need (or opportunity) to pass reference maybe once in two years. In other words, that's not (except maybe C) something you want to do often. This time I work with Java. I just wondered if there is any concise and elegant way (who knows?), so I decided to ask. I was quite ready to hear "no". [12:52]
magyar [magyar!~magyar@unaffiliated/magyar] has joined ##java [12:55]
lightslategrey surial, thanks for "to break the mold" expression. never saw this idiom [12:56]
ravenousmoose [ravenousmoose!~ravenousm@ptr-cud5aqffzafjlm1cu03.18120a2.ip6.access.telenet.be] has joined ##java [01:02]
somazero [somazero!~somazero@2600:8805:100:112:cbb5:3a7e:e144:4f17] has joined ##java [01:02]
minos_ [minos_!~simonbosm@137-152-21-31.ftth.glasoperator.nl] has joined ##java [01:05]
buttsanchez [buttsanchez!~buttsanch@pool-71-172-148-224.nwrknj.fios.verizon.net] has joined ##java [01:10]
Anthaas_ [Anthaas_!~Anthaas@unaffiliated/anthaas] has joined ##java [01:24]
LunarJetman [LunarJetman!LunarJetma@5ec1bc5a.skybroadband.com] has joined ##java [01:27]
Arlion [Arlion!~Arlion@unaffiliated/arlion] has joined ##java [01:30]
EgonX [EgonX!~Egon@2601:2c6:47f:98f4:68bd:6a3a:1394:fb6] has joined ##java [01:32]
srisri [srisri!~srisri@73.93.153.122] has joined ##java [01:33]
Human_G33k [Human_G33k!~HumanG33k@62.147.242.8] has joined ##java [01:33]
_homme__ [_homme__!emmanuelux@gateway/vpn/nordvpn/emmanuelux] has joined ##java [01:35]
emmanuelux [emmanuelux!~emmanuelu@84.17.42.99] has joined ##java [01:40]
_homme__ [_homme__!~emmanuelu@84.17.42.99] has joined ##java [01:41]
emmanuelux [emmanuelux!~emmanuelu@194.59.249.189] has joined ##java [01:46]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [01:46]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [01:50]
Arlion [Arlion!~Arlion@unaffiliated/arlion] has joined ##java [01:55]
manualcrank [manualcrank!~manualcra@bras-base-mtrlpq2718w-grc-09-70-24-225-95.dsl.bell.ca] has joined ##java [01:55]
lucid-lullaby [lucid-lullaby!lucid-lull@gateway/vpn/privateinternetaccess/lucid-lullaby] has joined ##java [02:00]
Nightwing52 [Nightwing52!~Thunderbi@71.221.200.189] has joined ##java [02:07]
Jantz [Jantz!~IceChat9@118-93-137-199.dsl.dyn.ihug.co.nz] has joined ##java [02:11]
Hatsjoe [Hatsjoe!~Hatsjoe@unaffiliated/hatsjoe] has joined ##java [02:25]
rruizt [rruizt!~rruizt@83-84-23-124.cable.dynamic.v4.ziggo.nl] has joined ##java [02:31]
orbyt_ [orbyt_!~orbyt@172.92.5.20] has joined ##java [02:36]
bartzy [bartzy!uid163429@gateway/web/irccloud.com/x-hnydoemzcqkkdxag] has joined ##java [02:36]
progart [progart!~kamee@46.241.199.70] has joined ##java [02:41]
kicked progart (Banned: please fix your connection. you're bouncing in and out. this ban will expire after 14d) [02:41]
ham [ham!~z0mbie@unaffiliated/ragnarokkr] has joined ##java [02:47]
Jantz [Jantz!~IceChat9@118-93-137-199.dsl.dyn.ihug.co.nz] has joined ##java [02:49]
minos_ [minos_!~simonbosm@137-152-21-31.ftth.glasoperator.nl] has joined ##java [02:49]
dv{0 [dv{0!~D@190.189.217.10] has joined ##java [02:58]
cak3st3r [cak3st3r!cak3st3r@gateway/vpn/privateinternetaccess/cak3st3r] has joined ##java [03:07]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [03:08]
sponge337 [sponge337!~sponge337@unaffiliated/sponge337] has joined ##java [03:11]
sponge337 Hello, I am trying to assert assertNull(foo.getANumber()) where getANumber() returns an integer. Why does this not work? Am I doing something wrong? [03:12]
plitter I'm having a pair as a key in map, is it possible to have a match on only one part of the pair to make it a hit? without having to create a custom pair? [03:13]
plitter using the javafx pair [03:13]
plitter just interested in suggestions, if it isn't possible I'll implement my own pair I guess... [03:14]
fizzie sponge337: If it returns an `int`, it can't ever be null. If it returns an `Integer`, then that sounds reasonable enough, assuming you've import static'd assertNull. A bit more detail than "does not work" would probably help. (Fails to compile? With what error? Compiles, but doesn't do what you expected?) [03:16]
sponge337 fizzie: Thank you. Yes it returns just an "int". It just says java.lang.AssertionError at some line. I would have expected that it asserts to true, but since you say, int can never be null... [03:19]
Maldivia plitter: need some custom impl for that [03:19]
surial fizzie: assertNull(someIntExpr); does not compile. [03:20]
fizzie surial: Wouldn't it autobox? [03:20]
surial actually, yeah, good point. [03:20]
surial sponge337: assertionerror 'at some line'.. um, is it that line? [03:20]
surial fizzie++ [03:20]
surial fizzie has a karma level of 10, surial [03:20]
fizzie But the autoboxed value certainly is never null, and since assertNull(x) asserts that x *is* null, it would always throw. [03:20]
Maldivia plitter: also, if you have a Pair(A, B)->X and Pair(A, C)->Y what should I get I do a lookup of Pair(A, *) ? [03:21]
surial fizzie: indeed. [03:21]
surial fizzie: but given that it was confusing and it was 'some line'.. eh, many things going wrong here. [03:21]
sponge337 surial: Yes, its that special line [03:21]
surial sponge337: okay, well, fizzie figured it out for you: an int autoboxesd to an Integer and can never be null. [03:21]
surial sponge337: thus, assertNull(exprOfInt) will always fail the assertion: assertNull succeeds if the expression is null, and it cannot be, thus: your assertion failed. [03:21]
surial sponge337: what are you trying to accomplish here? This test is literally completely useless. [03:22]
sponge337 surial: I thought so. I have a class with an int field. Lets say Foo.class with "private int age".I am calling this class with empty constructor, so no age is ever set. Now I want to assert that age is not set [03:23]
surial plitter: how would implementing your own pair let you do this? [03:23]
Maldivia plitter: is it 1st or 2nd value of the pair you want to lookup based on? or does it differ? [03:23]
sponge337 Maybe I could just say "private int age = -1" or something [03:23]
surial plitter: unless your idea is that 'same left-side = same key, and the right-side is an irrelevant dangling whatever'? [03:23]
surial sponge337: I think you're very confused. [03:23]
plitter Maldivia: yeah, that is true, currently the implementation is such that the there is 1 -> 1 on the pair... [03:23]
plitter surial: yes, basically [03:23]
surial sponge337: that has.. zero bearing on an assertNull test. perhaps pastebin your code. [03:23]
surial plitter: not much of a pair, that. [03:23]
surial plitter: shouldn't the B part of your pair then be part of the VALUE? [03:24]
surial (also, pair = stupid) [03:24]
plitter not really, it was just to avoid creating a new class [03:24]
sponge337 sponge337 is confused... it hurt itse÷f! [03:24]
surial that is stupid too. java is VERY nominal, to a fault. [03:24]
surial avoiding making new names is counter to the point of the language. [03:24]
plitter surial: I would contest the last one, constantly adding new classes when you can use simpler constructs makes code harder to read. [03:25]
surial If it's some throwaway code, _maybe_ you can defend it (personally, I'd just use lombok and make it easy to make new types), but you've already run into issues here, and storing part of the value in the key 'to save typing' is... I doubt any regular in this channel would find that anything but extremely bad planning. [03:25]
surial plitter: why would it? [03:25]
surial a Map<Person, AddressList> is a lot easier to read than a Map<Pair<String, Integer>, List<String[]>>. [03:25]
Maldivia plitter: if you have Map<Pair<A, B>, V> why not just have Map<A, Pair<B, V>> ? [03:25]
Maldivia (if you didn't care about the B part of the key anyway) [03:27]
plitter surial: you might have a Person object already and you might only require part of the Person object to make the key [03:28]
Maldivia well, that doesn't work for a HashMap, since that is based on equals and hashCode [03:29]
plitter Maldivia: I do care about B, I want to have B as information in case there is an error. [03:29]
Maldivia could with a TreeMap and a custom Comparator - but that tend to add confusion [03:29]
Nightwing52 [Nightwing52!~Thunderbi@71.221.200.189] has joined ##java [03:30]
plitter I think I'm better of creating my own class instead of messing around with the pair... [03:30]
Maldivia pair [03:30]
Maldivia Q: Why is Java such a manly language? A: Because every programmer has to grow a Pair. [03:30]
Maldivia ) [03:30]
plitter I'm thinking about just a normal class, and creating a proper equals [03:31]
plitter and hashcode [03:31]
Maldivia bingo [03:31]
plitter Strictly speaking there is other values that could be interesting to have with and did just take the 2 most important... [03:32]
Nightwing52 [Nightwing52!~Thunderbi@71.221.200.189] has joined ##java [03:33]
plitter This code is just taking way longer to do proper.... and feeling a little bit bad that it is taking so long.... [03:33]
plitter The other solution to make it would just be to have the first value and not having the second part. The second part was just to have more to use for debugging later, but the "key" will give me a good indication of where to look [03:36]
Hanii [Hanii!~Hanii@2a00:23c5:c587:a800:3882:a732:dac1:32ae] has joined ##java [03:36]
Jantz [Jantz!~IceChat9@2407:7000:8d04:100:e006:a688:7d18:814f] has joined ##java [03:45]
xeno [xeno!~xeno@unaffiliated/xeno] has joined ##java [03:51]
surial ~~ plitter lombok [03:55]
surial @Data public class Person { String name; int id } [03:55]
surial plitter: that'll do it. Make it @Value and it's immutable. [03:55]
surial er, I missed a semicolon but you get the idea. [03:55]
wreed [wreed!~wreed@2601:645:8100:8480:f801:38d1:63b2:2eb4] has joined ##java [03:58]
surial plitter: oh, and as you want to exclude the second bit: @Value public class Person { String name; @EqualsAndHashCode.Exclude int studentId; } [04:06]
surial literally fits on a single line easily. [04:06]
NorthwestVegan [NorthwestVegan!~Northwest@gateway/tor-sasl/northwestvegan] has joined ##java [04:09]
Nightwing52 [Nightwing52!~Thunderbi@71.221.200.189] has joined ##java [04:11]
nb-ben Pairs are almost never the right thing.. If you find yourself using these a lot (except where the concept of Pair actually makes sense, rather than just the virtue of referring two things), it's usually coincidental that you need only two references. You might later find yourself refactoring these to Tuple. [04:12]
surial good start, bad finish, there. [04:12]
surial java is _NOMINAL_. [04:13]
surial Hence why we do NOT have a general 'function' type: No, you need, specifically, a NAMED type to represent the structure of the lambda or you can't even start using lambda's in java. It's why we don't have extension methods. Don't take it from me, this is literally from Brian Goetz's mouth not 1 week ago. [04:13]
surial Thus, if you want to lean into how the language works instead of fight it, make shit and name it. [04:13]
surial Tuple3<String, Integer, LocalDate> is.. what is that? [04:14]
surial Student. Now that's clear. That's java (Student being defined as: class Student { String name; int studentId; LocalDate enrollment; } [04:14]
surial This makes java verbose, but also means java is impervious to cameraguns, and docs are always easy to find. [04:15]
[twisti] cameraguns ? [04:15]
Secret-Fire [Secret-Fire!~Secret-Fi@97-120-114-69.ptld.qwest.net] has joined ##java [04:16]
nb-ben <T> T combine(Pair<T>) would be a case where it might not be such a sin to use Pair, there are still alternatives but that would move us to positive avoidance rather than not using it where it's wrong. [04:19]
surial nb-ben: <T> T combine(Pair<T>) wtf? [04:19]
surial 99.9% of pair impls out there (and they're almost all a design error, but that's a separate issue) are defined as Pair<A, B>. Not Pair<T>. [04:19]
nb-ben find then <A,B,C> C combine(Pair<A,B>) [04:20]
Maldivia nb-ben: T combine(T a, T b) is much better [04:20]
nb-ben I agree [04:21]
Maldivia javadoc BiFunction [04:21]
Maldivia Maldivia: http://bit.ly/36Pv0KJ [JDK: java.util.function.BiFunction] [04:21]
Maldivia https://javabot.evanchooly.com/javadoc/JDK/11/java.base/java/util/function/BiFunction.html [04:22]
somazero [somazero!~somazero@2600:8805:100:112:cbb5:3a7e:e144:4f17] has joined ##java [04:22]
nb-ben I'm finding difficulty coming up with a good example of where a Pair makes sense but I also find it doubtful that there isn't any mechanism where the concept of a Pair of two things in a generic fashion for sure doesn't exist [04:22]
nb-ben for sure doesn't make sense * sorry [04:23]
nb-ben anyway, who cares [04:23]
surial nb-ben: it exists, but, it's rarely right. It should come up with code where the notion of Pair IS precisely what is needed, and it's not just shorthand for 'I have a <something more specific than -a value-> and a <something more specific than -a value-> and I can't be arsed to make a class for it'. [04:24]
surial It's in fact so rare, NONE of the utility stuff in java.util, j.u.concurrent, or j.u.function, or Stream API decided it was neccessary to make one of these. [04:25]
surial And they made fucking OPTIONAL For chrissake, so that's a real low bar and nevertheless Pair did not manage to clear it. [04:25]
nb-ben yes, that's what I was trying to express, with a poor example, and wording probably [04:25]
nb-ben so, that, there. [04:25]
surial I think for the sake of oversimplification and simple statements: A Pair class is never* correct. [04:25]
surial at some point mentioning the theoretical existence of a unicorn is just a dumb thing to say, but, I'm not sure if Pair has crossed into Unicorn territory. I suspect it has, but, »\_(?)_/» let's leave it to the reader :P [04:26]
[twisti] surial: cameraguns ? [04:27]
surial [twisti]: in java, if I have public interface Camera { public void shoot(Person p);} and public interface Gun {public void shoot(Person p);}... it is still quite hard for me to accidentally selfie some lead poisoning into my face. [04:28]
surial in Go, on the other hand, by creating both of those interfaces, you have instantly converted all cameras, and all guns, into CameraGuns, so, ya know. Been nice knowing ya. [04:29]
[twisti] surial: thats a cool example, thank you [04:29]
surial java's names are namespaced al the way down: Methods do not exist outside of types (there is no structural typing in java beyond exotic irrelevancies like the main method or the beanspec, none of which really lead to cameragun issues) - types are fully namespaced. [04:29]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [04:29]
surial in practice it's not cameraguns that get ya, it's the same thing by different parties. You define a notion of a 'camera' and I do too, and both of our interfaces have shoot() methods, but yours is slightly differently specced than mine. Someone who writes an impl of my camera interface entirely by accident has also implemented yours but because they don't even know about yours they did not follow the bits of spec that are not [04:30]
surial captured in the signature. Say, a rule that the image you return must be exactly 4M and no larger or whatnot. [04:30]
surial so I see some class that has a 'shoot' method (in Go) and I go: Cool. That will silently cast into [twisti]'s camera interface cuz, hey, shoot() is shoot() right, and shit goes wrong. silently. [04:31]
surial anyway, overuse of generics, such as Map<Tuple3<String, Integer, LocalDate>, List<List<String>>> instead of a Map<Person, AddressList> ALSO leads to cameragun issues. Said differently, a Comparator<Integer> has roughly the same method sig as an IntegralCalculatorButton (taking 2 ints and returning an int), but they do entirely different things, just like cameras and guns. It's GOOD that you can NOT use an integralcalculatorbutton [04:33]
surial instance as an ersatz comparator cuz it aint a comparator, was never designed to be one. [04:33]
surial TL;DR: Names! They are awesome! [04:33]
led_dark_1 [led_dark_1!~Thunderbi@217.66.160.14] has joined ##java [04:48]
wreed [wreed!~wreed@2601:645:8100:8480:f801:38d1:63b2:2eb4] has joined ##java [04:51]
bitwinery [bitwinery!~bitwinery@c-73-37-18-139.hsd1.wa.comcast.net] has joined ##java [04:52]
bitwinery [bitwinery!~bitwinery@c-73-37-18-139.hsd1.wa.comcast.net] has joined ##java [04:53]
con3 [con3!~kvirc@154.119.40.183] has joined ##java [04:59]
rruizt [rruizt!~rruizt@83-84-23-124.cable.dynamic.v4.ziggo.nl] has joined ##java [05:03]
alexi5_ [alexi5_!~alexi5@38.92.124.66] has joined ##java [05:03]
plitter I actually think that my usecase were relevant, f.ex. I have an object with many members and I'm analysing it for relevant data and removing the objects that don't satisfy some criteria. I'm filtering the objects 1 criteria at a time, taking out relevant members analysing and then deciding if the object is viable, instead of taking in the whole object and doing each object I doing part of the object [05:03]
plitter until I finish. But I don't want to create classes for each small part, and that is why I used a pair. [05:03]
fstd_ [fstd_!~fstd@unaffiliated/fisted] has joined ##java [05:05]
ivan18m [ivan18m!~ivan18m@unaffiliated/ivan18m] has joined ##java [05:07]
nb-ben plitter: good software pushes complexity into structure, it calls things by name. It's all "data". If your name is "data" then it's a bad name, we know it's data already. [05:08]
Sheilong [Sheilong!uid293653@gateway/web/irccloud.com/x-twuhvlydlxzzyddr] has joined ##java [05:09]
jmorris [jmorris!uid374834@gateway/web/irccloud.com/x-hynwjwwoocajtlsy] has joined ##java [05:22]
royal_screwup21 [royal_screwup21!89de72f4@gateway/web/cgi-irc/kiwiirc.com/ip.137.222.114.244] has joined ##java [05:24]
Maldivia (and yet you will find a class Data in waaay too many projects) [05:28]
plitter Sure, but it isn't necessary that you need a class for that, like naming variables is sometimes enough. F.ex. you don't create a new class for a student name, you just use String name, and have it in your student class. But lets say you want to use the name and age from the student class, you don't want to create a new class for containing that data temporarily. [05:33]
Siddart [Siddart!43badbb0@gateway/web/cgi-irc/kiwiirc.com/ip.67.186.219.176] has joined ##java [05:33]
bitwinery plitter, actually, some practices would recommend to define a type for student name [05:42]
bitwinery plitter, it avoids a whole class of issues (ex: some functions take two strings as parameter such as first name and last name, and someone may swap them by mistake) [05:43]
bitwinery similarly, that's also a reason why there isn't a real Pair class in java [05:43]
xa0s_ [xa0s_!xa0s@ma.sdf.org] has joined ##java [05:55]
zalt [zalt!~lambda443@unaffiliated/lambda443] has joined ##java [05:55]
jdfthetech [jdfthetech!~jdfthetec@cpe-104-174-3-76.socal.res.rr.com] has joined ##java [06:00]
wreed [wreed!~wreed@2601:645:8100:8480:f801:38d1:63b2:2eb4] has joined ##java [06:03]
cheeser tiny types is the name of that pattern [06:06]
cheeser kotlin has "inline classes" for that. and they're awesome. [06:07]
Anthaas [Anthaas!~Anthaas@unaffiliated/anthaas] has joined ##java [06:13]
emmanuelux [emmanuelux!~emmanuelu@2a01cb0000f393000d2f49708710a4ef.ipv6.abo.wanadoo.fr] has joined ##java [06:14]
wreed [wreed!~wreed@2601:645:8100:8480:f801:38d1:63b2:2eb4] has joined ##java [06:16]
gAb1 [gAb1!~chazy@139.47.102.0] has joined ##java [06:36]
ham [ham!~z0mbie@unaffiliated/ragnarokkr] has joined ##java [06:37]
gAb1 hi, i'm trying to get a count of how many times a class is instantiated, but when i use count++ in the constructor and then print the static property nothing is printed [06:40]
gAb1 can someone please tell me what am i doing wrong? https://bpaste.net/show/HB33Y [06:40]
gAb1 this is the main https://bpaste.net/show/X3SL6 [06:41]
gAb1 oops this one https://bpaste.net/show/XAUY2 [06:41]
Nightwing52 [Nightwing52!~Thunderbi@71.221.200.189] has joined ##java [06:45]
ernimril gAb1, you are missing something to actually print it, a %d might do [06:47]
gAb1 oh you're right, i completely missed it [06:51]
gAb1 thanks [06:51]
kupi [kupi!uid212005@gateway/web/irccloud.com/x-canecdfqavzncknj] has joined ##java [06:54]
gAb1 hmm i have another question, should i be using the constructor to do what's in line #23 and #24 (class Point) or should i have a method instead? [06:54]
surial gAb1: what? clone a point? [06:55]
surial gAb1: this is fine. If you want to be all fancy, give point a method: .withY(). This makes a new point with that point's X, and the provided Y. [06:55]
surial but that kind of 'nice code style' stuff has very little place in homework like this. [06:56]
surial gAb1: oh, you mean the Math.pow stuff in Point. [06:56]
gAb1 yes, i'm using that to calculate the distance [06:57]
surial that's.. not great, no, you should make a factory method for that if you want to use the right style (with the caveat: Homework and nice style don't really mesh well). [06:57]
gAb1 so do i just move it to the distance method? [06:57]
surial not necessarily. [06:57]
surial what is the constructor on lines 21-26 trying to accomplish? [06:57]
gAb1 nothing, just prepare the values to be used in distance() method [06:58]
surial yeah, just have public static double distance(Point a, Point b). [06:58]
gAb1 ok, thanks [06:59]
darkxploit [darkxploit!~jay@c-73-68-48-243.hsd1.ct.comcast.net] has joined ##java [07:01]
pikapika [pikapika!~pikapika@pika.powered.by.lunarbnc.net] has joined ##java [07:08]
classyMash [classyMash!classyMash@gateway/vpn/privateinternetaccess/classymash] has joined ##java [07:09]
royal_screwup21 [royal_screwup21!89de72f4@gateway/web/cgi-irc/kiwiirc.com/ip.137.222.114.244] has joined ##java [07:16]
gAb1 parted the channel: [07:19]
acidjnk_new [acidjnk_new!~acidjnk@200116b867e210002d192c444115f5ed.dip.versatel-1u1.de] has joined ##java [07:30]
hypc [hypc!~Thunderbi@113.233.192.38] has joined ##java [07:31]
nokdoot [nokdoot!~nokdoot@211.205.207.39] has joined ##java [07:44]
HumanG33k [HumanG33k!~HumanG33k@62.147.242.8] has joined ##java [07:44]
jimender2 [jimender2!uid320657@gateway/web/irccloud.com/x-poioipddngqlllvu] has joined ##java [07:47]
LearnAllTheTime [LearnAllTheTime!~LearnAllT@2601:cc:4000:9db0::1dcd] has joined ##java [07:47]
Dev0n [Dev0n!~Dev0n@unaffiliated/dev0n] has joined ##java [07:48]
db [db!uid18678@gateway/web/irccloud.com/x-itytjlufkohsancm] has joined ##java [08:04]
Bebef [Bebef!sbreit@phobos.bebef.de] has joined ##java [08:13]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [08:22]
extor [extor!~extor@unaffiliated/extor] has joined ##java [08:31]
Jantz [Jantz!~IceChat9@118-93-137-199.dsl.dyn.ihug.co.nz] has joined ##java [08:31]
yawkat [yawkat!~yawkat@cats.coffee] has joined ##java [08:42]
ham [ham!~z0mbie@unaffiliated/ragnarokkr] has joined ##java [08:45]
palasso [palasso!~palasso@unaffiliated/palasso] has joined ##java [08:51]
patred20 [patred20!~Thunderbi@2a02:a316:4044:ab00:d04a:d4b9:d772:3e87] has joined ##java [08:57]
royal_screwup21 [royal_screwup21!89de72f4@gateway/web/cgi-irc/kiwiirc.com/ip.137.222.114.244] has joined ##java [09:01]
emmanuelux [emmanuelux!~emmanuelu@82.102.18.110] has joined ##java [09:02]
xeno [xeno!~xeno@unaffiliated/xeno] has joined ##java [09:12]
realtime [realtime!realtime@gateway/vpn/privateinternetaccess/realtime] has joined ##java [09:20]
xeno [xeno!~xeno@unaffiliated/xeno] has joined ##java [09:23]
_homme__ [_homme__!~emmanuelu@2a01cb0000f39300d161cbf73ed32438.ipv6.abo.wanadoo.fr] has joined ##java [09:29]
Jantz [Jantz!~IceChat9@2407:7000:8d04:100:e006:a688:7d18:814f] has joined ##java [09:40]
nokdoot [nokdoot!~nokdoot@211.205.207.39] has joined ##java [09:43]
veegee [veegee!~veegee@ipagstaticip-3d3f7614-22f3-5b69-be13-7ab4b2c585d9.sdsl.bell.ca] has joined ##java [09:44]
xeno [xeno!~xeno@unaffiliated/xeno] has joined ##java [09:48]
Karyon [Karyon!~Karyon@unaffiliated/karyon] has joined ##java [09:58]
rohanrhu_ [rohanrhu_!~rohanrhu@78.181.238.50] has joined ##java [10:00]
Secret-Fire [Secret-Fire!~Secret-Fi@97-120-114-69.ptld.qwest.net] has joined ##java [10:08]
Secret-Fire [Secret-Fire!~Secret-Fi@97-120-114-69.ptld.qwest.net] has joined ##java [10:11]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [10:12]
rajrajraj [rajrajraj!uid72176@gateway/web/irccloud.com/x-bjqsppshngofkoen] has joined ##java [10:14]
zalt [zalt!~lambda443@unaffiliated/lambda443] has joined ##java [10:14]
Arlion [Arlion!~Arlion@unaffiliated/arlion] has joined ##java [10:17]
zalt [zalt!~lambda443@unaffiliated/lambda443] has joined ##java [10:17]
Nicmavr [Nicmavr!~Nicmavr@unaffiliated/nicmavr] has joined ##java [10:31]
Secret-Fire [Secret-Fire!~Secret-Fi@97-120-114-69.ptld.qwest.net] has joined ##java [10:31]
Anthaas [Anthaas!~Anthaas@unaffiliated/anthaas] has joined ##java [10:33]
Secret-Fire [Secret-Fire!~Secret-Fi@97-120-114-69.ptld.qwest.net] has joined ##java [10:35]
ellobo [ellobo!~dodobrain@unaffiliated/freakabcd] has joined ##java [10:47]
equwal [equwal!~equwal@c-73-189-232-225.hsd1.ca.comcast.net] has joined ##java [10:52]
nav2002 [nav2002!~nav2002@115.110.134.50] has joined ##java [11:02]
p[a]ddy [p[a]ddy!~Patrick-E@wikipedia/paddyez] has joined ##java [11:04]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [11:13]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [11:31]
sdu [sdu!~doo@80.107.19.72] has joined ##java [11:33]
BeerLover [BeerLover!~BeerBuddy@103.203.254.154] has joined ##java [11:36]
Nicmavr [Nicmavr!~Nicmavr@unaffiliated/nicmavr] has joined ##java [11:39]
zkxs [zkxs!~zkxs@ip70-178-126-58.ks.ks.cox.net] has joined ##java [11:41]
Nicmavr [Nicmavr!~Nicmavr@unaffiliated/nicmavr] has joined ##java [11:50]