Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "java8"
-
Aren't lambda expressions just the most frustrating thing sometimes? But how can you not love them when they get the job done in one-liners? 😍2
-
I was once at my uncle's 40th birthday party and bored to hell, so he gave me a book that was supposed to be "Python for kids". I started reading it and soon fell in love with programming.
Since then I've often learned new programming languages by reading books or lately mostly the internet.
My books here should be in chronological order:6 -
I'm currently rewriting perfectly clean and functioning Scala code in Java (because "Enterprise", yay). The amount of unnecessary boilerplate I have to add is insane. I'm not even talking big complicated code but two liners or the lack of simple things like a range from 5 to 10.
Why do I have to write
List<Position> occupiedPositions = placedEntities.stream()
.flatMap((pe) -> pe.occupiedPositions().stream())
.collect(Collectors.toList());
instead of simply
val occupiedPositions = placedEntities.flatMap(_.occupiedPositions)
Why on earth does `occupiedPositions.distinct` suddenly become a monstrosity like `occupiedPositions.stream().distinct().collect(Collectors.toList())` where the majority of code is pure boilerplate? And this is supposed to be the new and better Java8 api which people use as evidence that Java is now suddenly "functional" (yeah no, just no).
Why do APIs that annotate parameters with @Nullable throw NullPointerExceptions when I pass a null? Why does the compiler not help prevent such stupidity? Why do we use static typing PLUS those annotations and it still crashes at runtime like every damn dynamic, interpreted language out there? That's not unfortunate, it's a complete waste of time.
Why is a simple idea like a range from x to 10 (in scala literally `x to 10`) not by default included in Java? There's Guava's version of Range which does not have a helper for integer ranges (even though they are the most used ones). Then there's apache.commons version which _has_ a helper for integers, but is strangely not iterable (wtf I don't even...).
Speaking of Iterable: How difficult could it be to convert an abstract Iterable<T> into a concrete List<T>? In scala it's surprisingly `someIterable.toList`. I found nothing like that so I took to stackoverflow where I found a thread in which people suggested everything from writing your own ListUtils helper class, using Guava (which is a huge dependency!) to using the new Java8 features inline (which is still about three lines long). I didn't know this was such a hard problem in computer science, TIL.
How anyone can be productive in this abomination of a language is beyond me now, even though I've used it for many years while learning to code (back then I didn't know there were much better ways to do things). The only good part is that I have to endure this nonsense for only about 3 days longer then I'm free again!12 -
!!oracle
I'm trying to install a minecraft modpack to play with a friend, and I'm super psyced about it. According to the modpack instructions, the first step is to download the java8 jre. Not sure if I actually need it or not, but it can download while I'm doing everything else, so I dutifully go to the download page and find the appropriate version. The download link does point to the file, but redirects to a login page instead. Apparently I need an oracle account to download anything on their site. stupid.
So I make an account. It requires my life story, or at least full name and address and phone number. stupid. So my name is now "fuck off" and I live in Hell, Michigan. My email is also "gofuckyourself" because I'm feeling spiteful. Also, for some reason every character takes about 3/4ths of a second to type, so it's very slow going. Passwords also cannot contain spaces, which makes me think they're doing some stupid "security" shenanigans like custom reversible encryption with some 5th grade math. or they're just stupid. Whatever, I make the stupid account.
Afterwards, I try to log in, but apparently my browser-saved credentials are wrong? I try a few more times, try enabling all of the javascripts, etc. No beans. Okay, maybe I can't use it until I verify the email? That actually makes some sense. Fine, I go check the throwaway inbox. No verification email. It's been like five minutes, but it's oracle so they probably just failed at it like everything else, so I try to have them resend the email. I find the resend link, and try it. Every time I enter my email address, though, it either gives me a validation error or a server error. I try a few mores times, and give up. I try to log in again; no dice. Giving up, I go do something else for awhile.
On a whim later, I check for the verification email again. Apparently it just takes bloody forever, but it did show up. Except instead of the first name "Fuck" I entered, I'm now "Andrew", apparently. okay.... whatever. I click the verify button anyway, and to my surprise it actually works, and says that I'm now allowed to use my account. Yay!
So, I go back to the login page (from the download link) and enter my credentials. A new error appears! I cannot use redirects, apparently, and "must type in the page address I want to visit manually." huh? okay, i go to the page directly, and see the same bloody error because of course i do because oracle fucking sucks. So I close the page, go back to the download list, click the link, wait for the login page redirect (which is so totally not allowed, apparently, except it works and manual navigation does not. yay backwards!), and try to log in.
Instead of being presented with an error because of the redirect, it lets me (try to) log in. But despite using prefilled creds (and also copy/pasting), it tells me they're invalid. I open a new tab container, clear the cache (just to be thorough), and repeat the above steps. This time it redirects me to a single signon server page (their concept of oauth), and presents me with a system error telling me to contact "the Administrator." -.- Any second attempts, refreshes, etc. just display the same error.
Further attempts to log in from the download page fail with the same invalid credentials error as before.
Fucking oracle and their reverse Midas touch.10 -
The biggest annoyance in Java for me is the absence of "real" properties. Writing getters and setters everywhere is ugly, you are generating them anyways.7
-
The moment when you as an apprentice have to maintain the code of a java web application which was mostly written in 2004 with java 1.4.....
The most terrible part is that the production environment runs still java 1.7 and you think about the fancy java 8 features all the time😐😑😐7 -
The senior dev in my team wants me to convert all the lambda expressions I have written to anonymous inner classes. He says it will increase the code readability.
IT IS NOT MY FAULT THAT YOU CAN'T READ LAMDA EXPRESSIONS!!!!
It's like the dev has something against the new features of Java87 -
!rant
Goodbye Java I will not miss you at all! I swear ...
I do like it when making web services (especially that I can use Java8) but for Android you have been a torture. Hello sweet Kotlin! I shall embrace you and treat you like my newly born baby!!
Story is:
Working on a new project where I need to talk to a web service (also made by me).
Started writing in Java, all is cool and unit tests pass.
Downloaded Android Studio 3 Beta 1 and converted my Java code to Kotlin, That AsyncTask did not look nice in kotlin, converted it to async & await feature and I must admit lots of code removed, no more need to create a new fucking AsyncTask every time the app sneezes for data!
I feel like I'm working with C# but with difference in syntax.
My life is now complete :)undefined java goodbye! am i drunk? koline: sorry i have a boyfriend hi there kotlin i shall not miss you what the fuck did i just use for a tag?8 -
CIA – Computer Industry Acronyms
CD-ROM: Consumer Device, Rendered Obsolete in Months
PCMCIA: People Can’t Memorize Computer Industry Acronyms
ISDN: It Still Does Nothing
SCSI: System Can’t See It
MIPS: Meaningless Indication of Processor Speed
DOS: Defunct Operating System
WINDOWS: Will Install Needless Data On Whole System
OS/2: Obsolete Soon, Too
PnP: Plug and Pray
APPLE: Arrogance Produces Profit-Losing Entity
IBM: I Blame Microsoft
MICROSOFT: Most Intelligent Customers Realize Our Software Only Fools Teenagers
COBOL: Completely Obsolete Business Oriented Language
LISP: Lots of Insipid and Stupid Parentheses
MACINTOSH: Most Applications Crash; If Not, The Operating System Hangs
AAAAA: American Association Against Acronym Abuse.
WYSIWYMGIYRRLAAGW: What You See Is What You Might Get If You’re Really Really Lucky And All Goes Well.2 -
The best part is the satisfaction you get when you see the thing you've worked on for a long time being used and making people happy.
-
Colleague (Lead Engineer): Hey, check my code. I'm trying to group a list of Request objects by their id. Something is not working here
Me: * saw his code, had a lot of shitty loops, called all for a quick meet, changed his shitty mess to one liner
list.stream()
.collect(Collectors.groupingBy(Request::getId))
Walked out like a boss*
😎 -
How many of you feel functions API in Java8 should have support wiring up a Function and a Consumer :/
-
Java8: "the prevoius 2 api set of handling datetime were cumbersome, and not friendly so we introduced a whole new set of api's from jodatime"
(Looks at the new api trying to figure out how to get milis difference between a date and a timestamp, wants to kill everything and everyone in sight)
If i have to Google every simple date operations someone needs to pay -
That feeling when you come from other languages(like scala, c# or js) and you try to do a aggregation on a list in Java 8.. .
😤😭😩😰😱😵😧😖😲😕3 -
So yeah I just had Ubuntu show me two errors directly after startup, then claiming that there is a programming error in aptdaemon and then IntelliJ crashing because of a read-only FS.
After rebooting my VM im faced with a BusyBox prompt saying my disk is corrupted. Fuck VMWare. This is not the first time the disk in my VM got corrupted. -
Here are few questions that you could expect when attending a Java interview
1 - In which programming paradigm Java 8 falls?
2 - What is MetaSpace? How does it differ from PermGen?
3 - What are functional or SAM interfaces?
4 - What are static methods in Interfaces?
5 - What are the various categories of pre-defined function interfaces?2