4.2: ArrayLists in Processing - The Nature of Code

Поділитися
Вставка
  • Опубліковано 2 лют 2025

КОМЕНТАРІ • 67

  • @macieg8234
    @macieg8234 5 років тому +64

    Almost 4 years later - people are still watching your videos. You’re one of the best programming teachers I’ve ever had. I’m IT student from private IT academy and you are better than my lecturer - and your lessons are free. Within couple of weeks I’ll link your videos to my friends that are learning Java too. Stay awesome and make more videos!!! ❤️

    • @simonhollad5511
      @simonhollad5511 5 років тому +1

      Maybe because its private academy....

    • @DuniC0
      @DuniC0 3 роки тому +3

      And people are still learning Java...

  • @exhydraboy2429
    @exhydraboy2429 7 років тому +23

    World's best Java Teacher.

  • @72li208
    @72li208 5 років тому +2

    I take a moment to recognize your great work. I'm not a full time programmer but I've been doing a couple of web apps for my company and your javascript tutorial were always of great use, especially that p5.js is used a lot for visual animation and one can see directly the practical meaning behind the code.
    Now I'm taking up Java and I always have a look at your videos to assimilate the key principles.
    Thanks a lot !

  • @ericboyer6652
    @ericboyer6652 7 років тому +6

    Thanks Dan. Fed up with working with predefined size arrays, following you on neural network stuff and trying to implement that in a arduino robot, i got to come back to this usefull video. As usual when stuck, I got to get back to fondementals, and so thanks for this usefull piece. Have a great day.

  • @shyamavs4235
    @shyamavs4235 4 роки тому +8

    I was in bed, watching this, and sort of falling asleep, imagine my shock when he said 'don't fall asleep, wake up' !!! :O

  • @wollkann
    @wollkann 9 років тому +33

    This guy is great :) Quite fun to follow...

  • @Architector_4
    @Architector_4 6 років тому +1

    When I learned Processing, I ditched any tutorials and only studied the reference.
    Now I regret doing that. Not because I learned something the bad way or don't know something, but because I missed this beautiful, energetic man. ._.

  • @bengray8319
    @bengray8319 7 років тому +7

    hey just wanted to give you a massive thank you, you've been a great help to me in this video :)

  • @bastibob660
    @bastibob660 4 роки тому +2

    Thank you 😁
    That really really helped me out
    Huge respect to your programming and explaining skills 👏

  • @sulfrum
    @sulfrum 7 років тому +6

    it is what I was looking for... and the number of this video is 42... it couldn't be only a coincidence :P

  • @FreeDomSy-nk9ue
    @FreeDomSy-nk9ue 4 роки тому

    That was a very good explanation just like the lag in it.

  • @cesarbranco1889
    @cesarbranco1889 4 роки тому

    Dude this Prof took so much Kaffee, he is kind of crazy! haha I loved it

  • @elizaknight6980
    @elizaknight6980 7 років тому +2

    Thanks so much, I need this for my game project :)

  • @zippobrand
    @zippobrand 4 роки тому

    Hi Dan, I'm really hoping you will revisit this subject in your new Nature of Code and maybe explain how to sort an ArrayList because I'm having a hard time understand this and implement it in processing. Love.

  • @threadsnakegaming
    @threadsnakegaming 4 роки тому

    when his get looks like a cross between get and set, perfect for instruction

  • @newgamedk
    @newgamedk 8 років тому +5

    this is really awesome!

  • @MicheleZaccagnini
    @MicheleZaccagnini 9 років тому

    Daniel, Thanks a lot for your awesome videos. Quick question: I am using Processing in Python mode and I can't find a Python version of ArrayList. Do you know if there is some class that can substitute it? Or is it in the making?
    Thanks!

    • @TheCodingTrain
      @TheCodingTrain  9 років тому +1

      +Michele Zaccagnini You can just use a regular array in Python which is exapandable. See the Python Mode examples (Particle System or Flocking) for how it's done. Thanks for watching!

  • @DuniC0
    @DuniC0 3 роки тому

    Hi, I was wondering... why not use Java's Set, like HashSet, TreeSet or LinkedHashSet?

  • @johanrojassoderman5590
    @johanrojassoderman5590 5 років тому +1

    Wait, lists have types o.O
    JavaScript isn't even obnoxious AND consistent. It's just obnoxious.
    Great video btw, I have done some coding in c# but wanted to try something different, and your videos are as interesting even if it reintroduces things I recognice from c#. Perfect balance between efficiency and clarity.

  • @keanu_de_vos
    @keanu_de_vos Рік тому

    1:24 The way he made that noise 🤣🤣🤣🤣

  • @rgorazd
    @rgorazd 8 років тому +6

    Hi Daniel! First of all, thank you for your everything, giving to us! I really enjoy watching you, explaining things to us with such an enthusiasm! Second, I have a question. In your example, you use particles.add(new Particle()); which in my case does not work. I had to use particles.add(new Particle(new PVector(width/2, 20))); like in the example with only one particle. I'm using Processing 3. Regards!

  • @nektoxyz1013
    @nektoxyz1013 5 років тому

    why i cant create array of particles with :
    Particle[ ] particles = new Particle(50);
    i missed something? or something has changed in JS?
    Thanks.

  • @warrengeorge7126
    @warrengeorge7126 6 років тому

    A lot to take in but explained brilliantly

  • @END-oc4qu
    @END-oc4qu 6 років тому

    Hey if I wanted to multiply a 2 dimensional array by a value like 10 that has 3 rows and 4 columns with initial values present in each location, why would I set the "setw(5)" with the 5 argument instead of a (4) argument in this manipulator function.

  • @eandresrodriguez
    @eandresrodriguez 5 років тому

    Hi Daniel, you're such a great teacher. I write a "basic game" using processing and what you taught in ArrayList videos, but I got a weird behaviour that I'd like to help with. How could I share you my code to get comments from you or your java programmers followers?

    • @TheCodingTrain
      @TheCodingTrain  5 років тому

      I would suggest discourse.processing.org/! It's a good platform for Processing and p5.js related code questions. You can share code there easily! Feel free to link from here to your post.

  • @polyroguegames5820
    @polyroguegames5820 6 років тому +1

    Hey so if anyone is following this but using p5.js, you don't have to worry about ArrayList, since p5.js' array data structure is dynamic :)

  • @avemew5407
    @avemew5407 3 роки тому

    I managed to add and place objects from an array list and delete objects after clicking a button and then the object I want to delete, how in the world can I change the position of ONE object after clicked...? best regards ^^

  • @thefigmaster3519
    @thefigmaster3519 6 років тому +1

    Hi Dan, great vid! Do you have the working github link?

    • @TheCodingTrain
      @TheCodingTrain  6 років тому

      (Fixing! github.com/shiffman/The-Nature-of-Code-Examples/tree/master/chp04_systems/NOC_4_02_ArrayListParticles)

  • @BlueTarkus
    @BlueTarkus 7 років тому

    I don't think I fully understood the .get() method.
    When you write
    Particle p = particles.get(4);
    p.update();
    it means you're declaring a copy of the 5th particle and you're naming the copy "p", right?
    so with p.update() you're updating the copy, not the array itself, right?
    what am I missing here?

    • @reginahilt
      @reginahilt 7 років тому +1

      He said it passed the reference of the object. That means it is accessing the object itself and updates it.

  • @lulila_
    @lulila_ 2 роки тому

    Hey Dan! Could you make a video about string lists and text input from user? That would be super useful, thanks!!

  • @Charlie05155
    @Charlie05155 6 років тому

    Man I really need to thank you

  • @DasCartoonLand
    @DasCartoonLand 5 років тому

    dude youre the best!

  • @prtysh
    @prtysh 8 років тому

    Hey when I try running this, I get:
    build.pde:7:0:7:0: The constructor build.Particle() is undefined

  • @Zebsy
    @Zebsy 8 років тому +1

    Good fun watch, thanks. Is this Java ? chrz

    • @TheCodingTrain
      @TheCodingTrain  8 років тому +2

      Yes indeed it is! (Using Processing as an IDE)

  • @imtrying3981
    @imtrying3981 7 років тому

    IM SO HAPPY IT VHRISTMAS DAY!!!

  • @samvoor496
    @samvoor496 4 роки тому

    what programming language is this in?

  • @prtysh
    @prtysh 8 років тому

    Also, in the description, the link for github location is outdated, you have used a 0 prefix in the new folder structure. Please update the same for other viewers :)

  • @eotikurac
    @eotikurac 9 років тому

    my particle is a star shape but it is too big. what's a good way to resize the particle?
    edit: i couldn't do it with scale(), the stars would go crazy and all over the screen. it works with ellipse or rect, weirdly. so i eventually did it by tweaking the vector values and it's sort of okay but it's not the same thing.

    • @eotikurac
      @eotikurac 9 років тому

      +Daniel Shiffman i got the star particles in the right place with this method but they fall more slowly, as if the vector has been affected by scaling the shape down. this is bothering me a little because i don't know what is it that i'm doing wrong, but later in the chapter you showed how to inherit stuff from the main particle and use it for other particles so i got it going eventually and it looks spot on, so it doesn't really matter all that much. thank you.

  • @maciejjakubiak2828
    @maciejjakubiak2828 5 років тому

    Wait, I wrote EXACTLY the same code as you done, but it didn't work.
    What's going on?

    • @maciejjakubiak2828
      @maciejjakubiak2828 5 років тому

      Sorry, I didn't gave the particular reason of sketch bug. Somewhere in "particles.add(new Particle());", the program returns a error: "The constructor "Particle()" does not exist".

    • @TheCodingTrain
      @TheCodingTrain  5 років тому

      Would you mind asking at discourse.processing.org/! It's a better platform for Processing and p5.js related code questions. You can share code there easily! Feel free to link from here to your post.

  • @keanu_de_vos
    @keanu_de_vos Рік тому

    3:46 Hooray!!!
    🤣🤣🤣🤣🤣

  • @scamrev5800
    @scamrev5800 7 років тому +1

    Wish I could find out how to get past the get(0) to the values of the objects. Without 50 lines of code

    • @bennybrouwer
      @bennybrouwer 7 років тому

      It is not very clear in the documentation but as far as I understand, .get() is deprecated and should be replaced by the .copy() function, e.g. for copying a PVector named loc:
      location = new PVector();
      location = loc.copy();
      however, for a particle, the get() function still works - I don't know why

  • @adamwall-r6f
    @adamwall-r6f 7 років тому

    Thank you so much!

  • @titiento
    @titiento 6 років тому

    That "for" changed me

  • @lucianopazona9976
    @lucianopazona9976 8 років тому

    Gracias!

  • @puffolino1
    @puffolino1 8 років тому +1

    In the beginning you wrote Particle [] particle = new Particel [100];

  • @bettyevdokiagulayev4495
    @bettyevdokiagulayev4495 4 роки тому

    love

  • @keanu_de_vos
    @keanu_de_vos Рік тому

    2:49 "blue" "giant"🤣🤣🤣

  • @maf2525
    @maf2525 5 років тому

    In Java, I've always declared and initialized my arrays like this:
    float[] numbers = { 1.76, 1.68, 1.89, 1.72, 1.54,
    1.78, 1.34, 1.78 };

  • @PTM1008
    @PTM1008 5 років тому

    7:24 is the biggest lie ever told in the history of mankind. That too again and again!

  • @imtrying3981
    @imtrying3981 7 років тому

    OOPS i mean CHRISTMAS

  • @dhruvgaur7047
    @dhruvgaur7047 8 років тому

    I want to see you without beard.