Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main() {
- Structimplementationklasse a = new Structimplementationklasse( new Struc() );
- while( a.hasNext() ) {
- a.getNext();
- }
- }
- public class Structimplementationklasse implements Seq {
- Structimplementationklasse( Struc struc ) {
- this.struc = struc;
- }
- int i = 0;
- Struc struc;
- boolean hasNext(){
- if (i < struc.size()) return true;
- return false;
- }
- int getNext(){
- try{
- return ( struc.get(i++) );
- }
- catch ( EmptyException e ){ return 0;}
- }
- }
- public class Adapter {
- Adapter( Seq seq ) {
- m_seq = seq;
- }
- Seq m_seq;
- boolean hasNext() {
- return seq.hasNext();
- }
- int getNext() {
- return seq.getNext();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement