Andrew Ducker (andrewducker) wrote,
Andrew Ducker
andrewducker

I am starting to understand why people loathe Java

In C# I can create a dictionary that has ints as keys and strings as the values. I can then look up the value of any string using the int key. Dead simple. If I want an array I can use something like myDictionary.Values.ToArray() and I get all of the values in a string[], because it knows what type everything is. That's what generics are _for_.

Providing I am using Java correctly, I'm creating a HashMap<long,string> (and it has to be a Long, because you can't use primitive types, for some bizarre reason), and then the "put" method does, indeed, mandate that I'm using a Long and a String, but the "get" takes an object, and the toArray returns an array of _objects_. What the fuck? What is the point of specifying types if the compiler is going to just ignore them?

I feel terribly spoiled by working with a language which does what you bloody well tell it to, rather than being a half-assed job to give you the appearance of doing something useful without finishing the job.



Original post on Dreamwidth - there are comment count unavailable comments there.
Subscribe

  • instagram cross-post

    1) On the way to nursery, not had time to brush my hair yet. 2) Cool, calm, and professional. Original is here on instagram. Original post…

  • Interesting Links for 17-09-2021

    Tesla autopilot will randomly swerve towards pedestrians (tags: Tesla automation driving murder epicfail video ) The Fellowship of the Walk…

  • instagram cross-post

    Found another one of those nature sprites. Some kind of tree spirit, made visible by the fall of autumn leaves. Original is here on instagram.…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 26 comments

  • instagram cross-post

    1) On the way to nursery, not had time to brush my hair yet. 2) Cool, calm, and professional. Original is here on instagram. Original post…

  • Interesting Links for 17-09-2021

    Tesla autopilot will randomly swerve towards pedestrians (tags: Tesla automation driving murder epicfail video ) The Fellowship of the Walk…

  • instagram cross-post

    Found another one of those nature sprites. Some kind of tree spirit, made visible by the fall of autumn leaves. Original is here on instagram.…