I described up to
postfix using arrays assignment (#4).
int x[] = new int[100];
for (int i = 0; i< x.length; i++)
System.out.println(x[i]);
for (int p : x)
System.out.println(p);
interfaces
Iterable
Iterator
when I implement Iterable, I must provide a
method called iterator()
iterator returns Iterator
anything implementing Iterator must provide
boolean hasNext()
next()
int x[] = new int[100];
Iterator i = x.iterator();
while(i.hasNext())
{
int p = i.next();
System.out.println(p);
}
syntactic sugar
No comments:
Post a Comment