IndexListIterator che implementa Iterator mediante un array list. Implementazione di Iterator mediante cursore : ElementIterator per PositionList. Aggiunti alcuni metodi e spostato le classi IndexListIterator,ElementIterator nel package Iterator.
This commit is contained in:
@@ -6,6 +6,8 @@ import sequence.NodeSequence;
|
||||
import sequence.Sequence;
|
||||
import stack.NodeStack;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created with xgiovio.macbookair.
|
||||
* User: xgiovio
|
||||
@@ -27,6 +29,14 @@ public class ArrayIndexListTest {
|
||||
System.out.print(a);
|
||||
|
||||
|
||||
Iterator<test_object> it = a.iterator();
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import general_utility.test_object;
|
||||
import position.Position;
|
||||
import sequence.ArraySequence;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created with xgiovio.macbookair.
|
||||
* User: xgiovio
|
||||
@@ -22,6 +24,14 @@ public class ArraySequenceTest {
|
||||
|
||||
System.out.print (a.indexOf( a.next( a.first())));
|
||||
|
||||
Iterator<test_object> it = a.iterator();
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -32,11 +32,38 @@ public class NodePositionListTest {
|
||||
a.addLast(new Integer(4));
|
||||
|
||||
|
||||
global.cancellaDuplicati(a);
|
||||
|
||||
|
||||
System.out.print(a);
|
||||
|
||||
Iterator<Integer> it = a.iterator();
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
System.out.print(it.next());
|
||||
System.out.print(it.hasNext());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user