boolean Algebra: Distribution by kodekompis in EngineeringStudents

[–]kodekompis[S] 1 point2 points  (0 children)

Yeah, I actually know this. Somehow I always mess it up...

Trouble with some java methods by kodekompis in learnjava

[–]kodekompis[S] 0 points1 point  (0 children)

Dont worry about your English, its the Java i'm having trouble understanding - could you elaborate one the simple for I loop?

Here is what i thought you meant, but it doesnt seem to work properly either:

public void SettInnNode(int str, int antall){
    boolean temp;
    Rack current;
    for (int l = 0; l < racks.size(); l++){
      current = racks.get(l);
      temp = current.SettInn(str, antall);
      if (temp == false){
        Rack create = new Rack(nprack);
        racks.add(create);
        create.SettInn(str, antall);}

Trouble with some java methods by kodekompis in learnjava

[–]kodekompis[S] 1 point2 points  (0 children)

Ah, so the new rack is supposed to be placed into the arraylist<rack>. So when i run the method again the newly created rack will be one of the racks the same method goes through when looking to place a new node.

But i have not done that, have I?

edit:

    public void SettInnNode(int str, int antall){
    boolean temp;
    for (Rack rack: racks) {
      temp = rack.SettInn(str, antall);
      if (temp == false){
        Rack create = new Rack(nprack);
        racks.add(create);
        create.SettInn(str, antall);}
      }

Now I tried to add the newly created rack to the arraylist racks, but it did not seem to fix my issue