Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Created by Julio Tentor <jtentor@fi.unju.edu.ar>
- //
- import java.util.Random;
- public class DemoList5 {
- public static void main(String[] args) {
- System.out.println("Demo de lista enlazada doble con iterador y comparable");
- Random random = new Random();
- DoubleLinkedListIteratorComparable<Integer> lista1 = new DoubleLinkedListIteratorComparable<Integer>();
- int num;
- System.out.print("Numeros: ");
- for (int i = 0; i < 6; ++i) {
- num = random.nextInt(101);
- System.out.printf("%d ", num);
- lista1.addInOrder(num);
- }
- System.out.println();
- System.out.print("Lista1.: ");
- for (Integer element: lista1) {
- System.out.printf("%d ", element);
- }
- System.out.println();
- //PersonDemo();
- }
- private static void PersonDemo() {
- Person[] peopleArray = new Person[3];
- peopleArray[0] = new Person("Lopez", "Jorge");
- peopleArray[1] = new Person("Perez", "Juan");
- peopleArray[2] = new Person("Armata", "Jose");
- System.out.println("Personas en el arreglo: ");
- for (Person person : peopleArray) {
- System.out.println(person);
- }
- DoubleLinkedListIteratorComparable<Person> peopleList = new DoubleLinkedListIteratorComparable<Person>();
- for( Person person: peopleArray) {
- peopleList.addInOrder(person);
- }
- System.out.println("Personas en la lista ordenada: ");
- for (Person person : peopleList) {
- System.out.println(person);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement