Hi. Why would anyone annotate a class with same annotatio twice? Do you have any use case? Thanks Adam
@slartidan20 сағат бұрын
If you want to bind the same java method to two HTTP URL patterns you might want to annotate it twice. Just as an example - I don't even know if it would work 😁 So basically it often makes sense, if the annotation has fields. The exact same annotation twice (as in the video) is indeed questionable.
@bienadam19 сағат бұрын
I wanted to annotate a class with multiple references to a spec: @SpecReference(document = Documents.JAVA_ROCKS,chapter = "13") @SpecReference(document = Documents.DUKES_ADVENTURES,chapter = "42") This is how the idea for this short was born.
@pmorah4 сағат бұрын
@@bienadam got it. Thank you
@TheEliteGentleman22 сағат бұрын
Makes perfect sense now.
@TampaPirateКүн бұрын
Awesome
@vivekravi827Күн бұрын
Is this feature available in JDK21?
@bienadamКүн бұрын
Annotations were introduced with Java 5 / 1.5: docs.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Documented.html ...in 2004. Thank you for watching!
@memyselfandi32022 күн бұрын
Fully agree on the 'professional code'. Should be easy to read, easy to debug and easy to write tests for.
@user-ed1nw6vr8n2 күн бұрын
I don't even do java but i learned alot from you, this will help me alot when i actually learn java. Thanks for great content
@dylangrijalva9442 күн бұрын
What font are u sing?
@markusschmidt94252 күн бұрын
from an old man to other old mans :-) i think you are searching for the thrustmaster joysticks :-) the best sticks in the prehistoric time
@bienadam19 сағат бұрын
Old? You confused the podcasts :-) Thrustmaster! Exactly! It was decades before I was born, my grandmother told me stories about it... :-)
@TBRoT-zo4kh2 күн бұрын
long time no see😊
@sergeyshvyrev9693 күн бұрын
O_o!!! ))))
@satyarthtiwari77504 күн бұрын
Mine too fav language, can you please guide us and create one tutorial on how to become a skilled developer like you Adam!!! Plzzz I am a beginner and want to pursue a career in Java development.
@bienadamКүн бұрын
Attend airhacks.tv (Q&A livestream) and ask questions: kzfaq.infolive Also: join: discord.gg/airhacks and ask questions.
@selvakumart62195 күн бұрын
Your explanation was neat!!! Do you have any playlist explaining all features of Streams?
@ievgenmajor33016 күн бұрын
We saw bulshit. Use JMH for benchmark
@slartidan7 күн бұрын
One of the few situations, that (indeed) are better without var.
@bienadam7 күн бұрын
+1 It is indeed an exception from the rule in my project. Thanks for watching and commenting!
@kennedymbogo5427 күн бұрын
I think its time I also minimize its usage. my code precicely variables declared inside methods are all using it.
@thoaikieu57077 күн бұрын
Should I always use Api Files which is available since version 1.7?
@saila4567 күн бұрын
Call me a Boomer but I think in most cases non-var is better
@MarkJaeger7 күн бұрын
It's a bit of "this is what I am used to doing." Using var does remind us that the type of a variable is determined on the right side of the declaration, not by the type that we declare on the left, which can be a superclass or interface.
@MarkJaeger7 күн бұрын
Full disclosure, I was born in 1951, so I am pretty much the definition of a Boomer.
@slartidan7 күн бұрын
Do you have another example, where non-var is better than var?
@atha27 күн бұрын
@@slartidaneverywhere you store the result of a function
@TheBigLou136 күн бұрын
I also prefer to *always* use the actual type instead of var, because it makes it easy and clear to see what you're dealing with. If you look at the code at a later point in time you sometimes have no idea what kind of class you're dealing with and what options/methods you have available with it. If you see the Type you immidiately know how the thing works.
@pawanprasoonmishra11408 күн бұрын
Where ‘world’ went ?
@mm32008 күн бұрын
Line after it added "hello" after "world", and next line after it added "duke" before "world". So "world" wasn't first or last element in collection.
@daripher8 күн бұрын
He didn't print all the elements of the array, only first and last.
@blankbox338 күн бұрын
mind blowing and very inspiring podcast..
@devdavkup9 күн бұрын
Fix the location of the camera video, on mobile devices it is overlapped by the KZfaq interface
@abdushakoor00999 күн бұрын
Nice
@hammadhassan1679 күн бұрын
How can interface contain a main function? Is it a new update?
@stocothedude10 күн бұрын
I recently used the sdk http client as well and its great! I want to try the apache httpclient one day
@bienadam9 күн бұрын
The built-in Java HttpClient is a good place to start. I would only use 3rd party libraries for very specific use cases. "No dependencies, no problems. " Thank you for watching!
@memyselfandi320210 күн бұрын
Also started out with Java and J2ME developing games for Mobile devices back in the Mid 2000s. Also can remember when Bluetooth came up and trying to write the first multiplayer game for Siemens. A the wonder years of craming a game into a 64kb/200kb jar file with all the assets and not way to patch them.
@jimishukurow228611 күн бұрын
Nice!
@rydmerlin11 күн бұрын
Please separate the educational content and non-education context in your playlists ;-)
@MarkJaeger11 күн бұрын
What isn't educational about learning how Instant works? Using Calendar was a pain.
@rydmerlin11 күн бұрын
@@MarkJaeger Apologies for the confusion but I'm just commenting here in general not specifically to this video. Just a video associated with his playlist. The "meet and greet" videos are what I would call non-educational and I'd prefer those were separated from this playlist.
@prasoonmishra395912 күн бұрын
Thank you 🙏
@jack917112 күн бұрын
is there any reason why of factory method is not taking varargs
@MarkJaeger11 күн бұрын
Map.of has just eleven overloaded methods. You just enter key/value pairs. With Masp.ofEntries, you have to instantiate entries.
@ShinMugenNoKabe12 күн бұрын
Very nice to have specially when you have so many key-value pairs that you want to add that you start to lose track of what you put...
@karthikrajasangaiah116814 күн бұрын
You can make use of Externalizable instead
@happydev51215 күн бұрын
Thank you the video!
@khalilelemam134915 күн бұрын
Is it useful. I can't think of a use case for this. Also i have another question..when you are customizing the obj at the read or write. Is it the same object or it just returning a new object?
@walterwatz-vy2re15 күн бұрын
Unfortunately is not a concurrent run... And the double use of runnable is at least misleading... And what will you do if you runable implements more than one line without yielding in unreadable code?
@shankyboiman16 күн бұрын
How can we write main in an interface?
@tharteon186617 күн бұрын
Try more complex scenarios, branch predictions in a loop so tight might optimize all the branches, or almost all of them. If you made a more complex program the compiler might not predict it so well. Try adding some other branches inside the loop and other stuff, stimulating a real scenario, and most probably it won't be so efficient.
@MarkJaeger16 күн бұрын
OK, but complexity is not a desirable design
@tharteon186616 күн бұрын
@@MarkJaeger its not about "complex design" is about complex branching. In a real program, when dealing with loops, usually there are several branches inside a loop. Either normal ifs, switches, vtables, etc. This branching complexity might considerably reduce the prediction of branches, therefore using these operations will notably reduce performance. STILL this is bullcrap in a real application, only relevant for extremely hot code. This seems fine overall. I just program real time applications and I know I wouldn't use these for hot code.
@MarkJaeger16 күн бұрын
@@tharteon1866 your branching within loops sounds like a direct violation of the Single Responsibility Principle. Hence my reference to design issues.
@tharteon186616 күн бұрын
@@MarkJaeger Don't be mistaken, dynamic dispatch is also a type of branch. What you call single responsibility is basically an application of OOP inheritance or interfacing. When dealing with multiple implementations of a method, then we are also dealing with dynamic dispatch, which is a type of branching, which will lead to failed branch predictions anyways.
@bienadam16 күн бұрын
I suggest the following: write simple and clear code, measure performance, improve if necessary. Is this a good strategy? Good discussion by the way. Thanks for watching and commenting!
@IgorYegorkin17 күн бұрын
Nice result. Maybe because x86 architecture is great and CPU already checks integer overflow.
@bienadam17 күн бұрын
ARM seems also to do well. I recorded this video on an “Apple Sillicon” (ARM). Thanks for watching!
@IgorYegorkin17 күн бұрын
Actually in my case difference is random and sometimes is equal to 100 ms on x86 CPU
@madcabbage353517 күн бұрын
Is there any difference between data types. Does one perform better than the other fpr certain data types or maybe addExact is worse for floating point double and float
@walterwatz-vy2re17 күн бұрын
Strasse ist keine Alternative, sondern einfach falsch, Antwort hatte sein müssen: false
@bienadam17 күн бұрын
…now we have to patch the JDK… Seriously: I recorded this short with the weakest “strength” (docs.oracle.com/javase/8/docs/api/java/text/Collator.html#setStrength-int-). A test with the other strengths (e.g. SECONDARY) is failing. Thanks for watching!
@WalrusWarrior17 күн бұрын
List.of returns unmodify list. Nice trick!
@bienadam17 күн бұрын
Thank you!
@daripher18 күн бұрын
I'm just never using `var`. It makes code unreadable in most cases, especially outside of IDE.
@bienadam17 күн бұрын
+1 If you cannot always rely on IDE - then you have to be more careful with the “var”. I’m using VSC all the time.
@reeeeel285818 күн бұрын
Wow that's great , I'll try it
@bienadam17 күн бұрын
It’s interesting, right? Thanks for watching!
@mkrgl19 күн бұрын
You can use: print(Map.<String, Integer>of());
@bienadam17 күн бұрын
+1 you are right, but I would prefer to declare a variable without the "var" in this case. Thanks for watching!
@slartidan19 күн бұрын
"this." for field access does not improve the readability in this case, in my opinion.
@petraubrecht776219 күн бұрын
Introduced as "this will be used only in complex types in streams", but really used to make Java more similar to JavaScript - pretending, that you don't need to care about types 😔 It gave up the clarity of Java code.
@axoloth19 күн бұрын
Wow that's nice
@booyesum173020 күн бұрын
I’m currently learning l10n and i18n in Java, and I’m also studying A1 German so this is a perfect short! Danke!
@bienadam17 күн бұрын
Thank you for watching and commenting!
@walterwatz-vy2re13 күн бұрын
@@booyesum1730 if you learn German, that just take in mind, Strasse is simply wrong!
@booyesum173013 күн бұрын
@@walterwatz-vy2re Ich weiß 🙂
@zahidahmed704320 күн бұрын
Nice. Keep up the good work.
@bienadam17 күн бұрын
Thank you for watching. Recording Java shorts is fun :-)
@stocothedude20 күн бұрын
very cool feature! thank you for showing
@bienadam20 күн бұрын
Thank you for watching!
@pauldaly1yt20 күн бұрын
Files is a great class!
@bienadam17 күн бұрын
The best for file handling :-) Thanks for watching!