Announcement

Collapse
No announcement yet.

Programming question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    Originally posted by BlackCat View Post
    Simple array, yes, but aren't we discusing multidimensional arrays ? Strings ?
    Dude, how do you think Java implements multidimensional arrays?

    And do you REALLY need me to post the implementation of String? IT IS JUST A WRAPPER AROUND A CHAR[].

    Comment


    • #47
      Originally posted by BlackCat View Post
      Oh, and overhead can actually be an issue .
      No, I'm sorry, the overhead of a method call in Java is never an issue unless you are completely incompetent.

      Comment


      • #48
        Do we really have to play the "BlackCat defends some dumb comment he made long past the point that it's obvious to everyone else that he's wrong" game again?

        Comment


        • #49
          Originally posted by Hauldren Collider View Post
          Really? Okay, I was under the false impression that they were some special structure or whatnot.

          The most annoying thing about string arrays is Java's refusal to overload == to test string equality as opposed to just comparing the references. I don't know, I feel like they should have just made an exception for strings.
          No, that would be horrible. The correct answer is to make == syntactic sugar for an equals() call and make === or some other operator test reference equality.

          Comment


          • #50
            Originally posted by Kuciwalker View Post
            Actually, arrays kind of suck. It's hard to come up with a case where I'd actually want to use them if a halfway decent collections library is available.
            Hope you're joking.

            The performance differences between collections and arrays is significant. Less so in Java, but still significant. Further still, iterating through lists is usually significantly faster also.
            "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
            Ben Kenobi: "That means I'm doing something right. "

            Comment


            • #51
              Originally posted by BlackCat View Post
              Oh, and overhead can actually be an issue .
              Overhead of this kind is not really an issue in Java as it's running in a VM anyways and the overhead of function calls is so minute.

              You start to notice function calls when you're doing high-performance parallel or graphics computing but you're probably using C, C++ or Fortran for that in which case much of the coding guidelines of Java no longer apply.

              When I did a simulation of n-body planetary motion in Parallel Computing last year, there was one place where taking out a function call actually noticeably sped my program up. But you are unlikely to hit that issue in java.
              If there is no sound in space, how come you can hear the lasers?
              ){ :|:& };:

              Comment


              • #52
                Originally posted by Asher View Post
                Hope you're joking.

                The performance differences between collections and arrays is staggering.
                Which language and which collections? As above, ArrayList is just a shim over arrays anyway...

                Comment


                • #53
                  Originally posted by Kuciwalker View Post
                  No, that would be horrible. The correct answer is to make == syntactic sugar for an equals() call and make === or some other operator test reference equality.
                  That's one way of doing it. I would actually go the other route and do === is syntactic sugar for equals() because I think (rather subjectively/arbitrarily) that it would be more consistent with the way PHP and Javascript use === to test for type and value equality.

                  My point was mainly that it's annoying to test equality of strings and that I don't think there are compelling reasons not to make it more convenient.
                  If there is no sound in space, how come you can hear the lasers?
                  ){ :|:& };:

                  Comment


                  • #54
                    Originally posted by Kuciwalker View Post
                    No, I'm sorry, the overhead of a method call in Java is never an issue unless you are completely incompetent.
                    You are just joking -I at least hope that you are
                    With or without religion, you would have good people doing good things and evil people doing evil things. But for good people to do evil things, that takes religion.

                    Steven Weinberg

                    Comment


                    • #55
                      Originally posted by Kuciwalker View Post
                      Holy ****, you are dumb.

                      HERE ARE THE RELEVANT PIECES OF CODE FROM ARRAYLIST.JAVA IN THE ACTUAL ****ING JDK VERSION 6.18:
                      ArrayList is an exception, not a rule.
                      "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
                      Ben Kenobi: "That means I'm doing something right. "

                      Comment


                      • #56
                        Originally posted by Kuciwalker View Post
                        Which language and which collections? As above, ArrayList is just a shim over arrays anyway...
                        You're cherrypicking ArrayList because it's just an Array which implements the List interface.

                        I thought it was clear the concept of the discussion was arrays vs real collections. An ArrayList is, for all intents and purposes, an array. It just comes with a List interface to it.
                        "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
                        Ben Kenobi: "That means I'm doing something right. "

                        Comment


                        • #57
                          [QUOTE=Asher;5879236][QUOTE=Kuciwalker;5879219]Holy ****, you are dumb.

                          HERE ARE THE RELEVANT PIECES OF CODE FROM ARRAYLIST.JAVA IN THE ACTUAL ****ING JDK VERSION 6.18:
                          ArrayList is an exception, not a rule.
                          Actually LinkedList, HashMap, etc are all pretty much thin shims as I recall.
                          If there is no sound in space, how come you can hear the lasers?
                          ){ :|:& };:

                          Comment


                          • #58
                            lol Man, you guys are really going at it.

                            Comment


                            • #59
                              Originally posted by Asher View Post
                              You're cherrypicking ArrayList because it's just an Array which implements the List interface.

                              I thought it was clear the concept of the discussion was arrays vs real collections.
                              And I thought it was clear the discussion was "should you ever use arrays, or should you use the relevant Collections class?" If you need an array you should use ArrayList. This is 1000x as true in Java with the half-assed generics.

                              Comment


                              • #60
                                Originally posted by Hauldren Collider View Post
                                Actually LinkedList, HashMap, etc are all pretty much thin shims as I recall.
                                Uh, what is LinkedList supposed to be a shim over?

                                Comment

                                Working...
                                X