Announcement

Collapse
No announcement yet.

Programming question

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

  • #61
    Originally posted by Hauldren Collider View Post
    Actually LinkedList, HashMap, etc are all pretty much thin shims as I recall.
    If LinkedList is a simple shim over an array, I'd personally strangle James Gosling next time I see him.
    "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


    • #62
      Originally posted by Kuciwalker View Post
      Uh, what is LinkedList supposed to be a shim over?
      Well it's just a few references actually, it isn't really a shim over anything I guess, but there's really not much to it.

      This is from memory so if someone actually gets the documentation I'll probably have details wrong but my recollection is it's basically just

      Linked List:
      -ListNode head
      methods

      ListNode:
      ListNode next
      ListNode previous
      {whatever the generic object thingy is in Java} value
      methods

      And it implements all the interfaces.
      If there is no sound in space, how come you can hear the lasers?
      ){ :|:& };:

      Comment


      • #63
        Originally posted by Asher View Post
        If LinkedList is a simple shim over an array, I'd personally strangle James Gosling next time I see him.
        No, even the Sun developers aren't that incompetent.

        Comment


        • #64
          Originally posted by Hauldren Collider View Post
          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.
          Well, my knowledge about java isn't that good - my main experience of it is customisable (?) functions for data validation, and there a couple of miliseconds doesn't matter much.

          My main argument is when you have to deal with large amounts of data, and there I would never use java.
          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


          • #65
            Originally posted by Hauldren Collider View Post
            Well it's just a few references actually, it isn't really a shim over anything I guess, but there's really not much to it.

            This is from memory so if someone actually gets the documentation I'll probably have details wrong but my recollection is it's basically just

            Linked List:
            -ListNode head
            methods

            ListNode:
            ListNode next
            ListNode previous
            {whatever the generic object thingy is in Java} value
            methods

            And it implements all the interfaces.
            Do you understand how a linked list works and why it would not make sense to build it around an array?
            "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


            • #66
              Originally posted by Asher View Post
              Do you understand how a linked list works and why it would not make sense to build it around an array?
              Yes. Jesus christ asher, you're acting like I'm some dumb kid...

              oh wait. ****.

              HOWEVER: If you want a definition

              A linked list is a list where the values are stored anywhere in memory and are connected to each other by reference, such that each node has a reference to the next node and to the previous node for doubly-linked lists. This allows O(1) insertion but requires O(N) lookup time. Do not try to binary search a linked list. A classmate did that. We laughed at him.
              If there is no sound in space, how come you can hear the lasers?
              ){ :|:& };:

              Comment


              • #67
                Self deprecation gets you nowhere in life. Do you think self defecation is how I get women/jobs/anything? Everyone wants a confident man

                Comment


                • #68
                  Originally posted by Wiglaf View Post
                  Self deprecation gets you nowhere in life. Do you think self defecation is how I get women/jobs/anything? Everyone wants a confident man
                  Self deprecating humor is how I keep the attention of the class of sorts I teach about systems administration at school AND SO FAR THIS YEAR EVERY SINGLE CLASS HAS HAD MORE GIRLS COME TO IT THAN THE LAST*


                  *AND NOT ALL OF THEM LOOK HIDEOUSLY DISFIGURED
                  If there is no sound in space, how come you can hear the lasers?
                  ){ :|:& };:

                  Comment


                  • #69
                    FWIW, it's my experience that ArrayList is 25-33% slower than Arrays for things like iterating.

                    In Java, a "foreach" low is MUCH slower than a traditional for loop due to the construction of iterators. Awful design.
                    "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


                    • #70
                      that's terrible

                      That said, if you care about the performance you can just write the normal for loop.

                      Comment


                      • #71
                        Originally posted by Kuciwalker View Post
                        That said, if you care about the performance you can just write the normal for loop.
                        Good to see that you actually agree with me
                        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


                        • #72
                          In C I just use the goto's for efficiency, much faster that way.

                          The method calls are too slow as well, so I just goto inside methods.

                          I heard about this loop unrolling thing but it sounded like some toilet paper related activity and ever since my car was covered in toilet paper I have a crippling fear of it.
                          If there is no sound in space, how come you can hear the lasers?
                          ){ :|:& };:

                          Comment


                          • #73
                            Nah, goto is for children - try experiment with longjmp that can really mess things up
                            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


                            • #74
                              Originally posted by BlackCat View Post
                              Good to see that you actually agree with me
                              Holy **** you are dumb. You can write a normal for loop over an ArrayList just fine. It is using the syntactic sugar intended for things that can't be treated as arrays that, guess what, aren't optimal for use with things that act exactly like arrays.

                              Comment


                              • #75
                                Do you know what the difference is between:

                                Code:
                                for (int i = 0; i < x.length; i++) {
                                    System.out.println(x[i]);
                                }
                                and

                                Code:
                                for (int i = 0; i < x.size(); i++) {
                                    System.out.println(x.get(i));
                                }
                                ?

                                The second one isn't obsolete as of this century.

                                Comment

                                Working...
                                X