Click here to Skip to main content
15,353,818 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: More Weaseling. Pin
Jörgen Andersson25-May-21 1:11
professionalJörgen Andersson25-May-21 1:11 
GeneralRe: More Weaseling. Pin
Jörgen Andersson25-May-21 1:35
professionalJörgen Andersson25-May-21 1:35 
GeneralRe: More Weaseling. Pin
honey the codewitch25-May-21 1:39
mvahoney the codewitch25-May-21 1:39 
GeneralRe: More Weaseling. Pin
Jörgen Andersson25-May-21 1:42
professionalJörgen Andersson25-May-21 1:42 
QuestionRe: More Weaseling. Pin
SeanChupas25-May-21 2:26
MemberSeanChupas25-May-21 2:26 
AnswerRe: More Weaseling. Pin
Gerry Schmitz25-May-21 5:17
mveGerry Schmitz25-May-21 5:17 
GeneralRe: More Weaseling. Pin
kmoorevs25-May-21 3:23
Memberkmoorevs25-May-21 3:23 
GeneralToday IntelliJ deflated my ego big time! Pin
Cp-Coder24-May-21 12:35
MemberCp-Coder24-May-21 12:35 
Working with my current favorite JavaFx using the IntelliJ IDE, I faced a problem earlier today. I had a two-dimensional array of objects to sort. Think for the array as something like:

Object[][] myArray = new Object[88][155]

Index 1 of each sub array held a string as an object. In other words myArray[][1] was a string object.
The problem: To sort the array in alphabetical order for this string.

I looked at the problem and thought: "No way is there a simple solution for this! I'm going to have to write a sorting class for the job. It took me a couple of hours but I got it working in less than 30 lines of code. And it worked well. Just as I was getting ready to pat myself on the shoulder, I developed a nagging thought (don't you just hate those spoiler nagging thoughts?) that I may have overlooked a more simple solution.

So I did an online search and came across a solution to do the sort in some 6 or 7 lines. Skeptically I tried adapting the code to my situation. As I was about to try it out, up pops IntelliJ, suggesting it would be simpler to use a Lambda expression. It even offered to do the conversion for me. So I thought: "What the heck, let's give it a try.

Sure enough IntelliJ's Lambda worked. About three lines of code!

But IntelliJ was not done humiliating me. Up it pops with a suggestion that it can convert the Lambda to a "super lambda" or something of the sort. What could I do? I had to tell it to proceed and voila: The whole sorting action on a 2 dimensional object array done in a single line of code! Here it is:

Arrays.sort(myArray, Comparator.comparing(o -> String.valueOf(o[1]).toLowerCase()));

Tonight I will have nightmares of vicious IDEs chasing after me to correct all my many mistakes! Unsure | :~
Get me coffee and no one gets hurt!



modified 25-May-21 9:55am.

GeneralRe: Today Intellij deflated my ego big time! Pin
Greg Utas24-May-21 13:32
mveGreg Utas24-May-21 13:32 
GeneralRe: Today Intellij deflated my ego big time! Pin
enhzflep24-May-21 18:04
Memberenhzflep24-May-21 18:04 
GeneralRe: Today Intellij deflated my ego big time! Pin
Dar Brett25-May-21 2:56
MemberDar Brett25-May-21 2:56 
GeneralRe: Today Intellij deflated my ego big time! Pin
Stuart Dootson27-May-21 2:07
professionalStuart Dootson27-May-21 2:07 
GeneralRe: Today Intellij deflated my ego big time! Pin
Richard Deeming24-May-21 22:04
mveRichard Deeming24-May-21 22:04 
GeneralRe: Today Intellij deflated my ego big time! Pin
jsc4224-May-21 22:26
professionaljsc4224-May-21 22:26 
GeneralRe: Today Intellij deflated my ego big time! Pin
Slacker00724-May-21 22:30
professionalSlacker00724-May-21 22:30 
GeneralRe: Today Intellij deflated my ego big time! Pin
Greg Utas25-May-21 1:52
mveGreg Utas25-May-21 1:52 
GeneralRe: Today IntelliJ deflated my ego big time! Pin
Nelek9-Jun-21 19:51
protectorNelek9-Jun-21 19:51 
QuestionSPI Debugging - a question for hardware hackers Pin
honey the codewitch24-May-21 11:07
mvahoney the codewitch24-May-21 11:07 
AnswerRe: SPI Debugging - a question for hardware hackers Pin
Kelly Herald24-May-21 11:32
MemberKelly Herald24-May-21 11:32 
GeneralRe: SPI Debugging - a question for hardware hackers Pin
honey the codewitch24-May-21 12:05
mvahoney the codewitch24-May-21 12:05 
GeneralRe: SPI Debugging - a question for hardware hackers Pin
M Kellett26-May-21 1:38
MemberM Kellett26-May-21 1:38 
GeneralRe: SPI Debugging - a question for hardware hackers Pin
charlieg26-May-21 12:07
Membercharlieg26-May-21 12:07 
AnswerRe: SPI Debugging - a question for hardware hackers Pin
Mike Hankey24-May-21 11:45
professionalMike Hankey24-May-21 11:45 
GeneralRe: SPI Debugging - a question for hardware hackers Pin
honey the codewitch24-May-21 12:04
mvahoney the codewitch24-May-21 12:04 
GeneralRe: SPI Debugging - a question for hardware hackers Pin
Mike Hankey24-May-21 12:14
professionalMike Hankey24-May-21 12:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

What language are you using for AI development or learning?
Whether you're at work or home, hard core coding or just trying to figure out this AI thing, which languages have you used in your adventures?
  Results   455 votes