public void add(Object newObject1, Object newObject2, Object newObject3, Object newObject4, Object newObject5) { ListElement newElement1 = new ListElement(newObject1); ListElement newElement2 = new ListElement(newObject2); ListElement newElement3 = new ListElement(newObject3); ListElement newElement4 = new ListElement(newObject4); ListElement newElement5 = new ListElement(newObject5); newElement1.next = head.next; newElement2.next = newElement1; newElement3.next = newElement2; newElement4.next = newElement3; newElement5.next = newElement4; head.next = newElement5; number += 5; //erhöhe Listenanzahl }
public void add(Object newObject1, Object newObject2, Object newObject3) { ListElement newElement1 = new ListElement(newObject1); ListElement newElement2 = new ListElement(newObject2); ListElement newElement3 = new ListElement(newObject3); newElement1.next = head.next; newElement2.next = newElement1; newElement3.next = newElement2; head.next = newElement3; number += 3; //erhöhe Listenanzahl }
public void add(Object newObject1) { ListElement newElement = new ListElement(newObject1); newElement.next = head.next; head.next = newElement; number++; //erhöhe Listenanzahl }
public Listing(int Type) { Card car; head = new ListElement(null); if (Type == 1) //neuer Kartenstapel { int i = 2; do { for (int j = 2; j <= 13; j++) { car = new Card(i, j); this.add(car); } switch(i) { case 2: i=3; break; case 3: i=5; break; case 5: i=7; break; default: i=0; break; } }while(i!=0); this.add(new Card(0, 0));//Joker this.add(new Card(0, 0)); } }
public Listing() { head = new ListElement(null); }
public bool rm(Object toRemove) { if (next.data == toRemove) //falls der Inhalt des nächsten Objekt das löschende ist { next = next.next; //überspringe dieses Objekt return true; } if (next.next == null) //falls das Ende der Liste, dann beende { return false; } return next.rm(toRemove); //Rufe das nächste Objekt auf }