From 65129779bf7c447acc14c648f9e96c5713acd8c7 Mon Sep 17 00:00:00 2001 From: Le Thu Nguyen <10757059+nglthu@users.noreply.github.com> Date: Thu, 7 Mar 2024 06:25:54 +0000 Subject: [PATCH] selector --- src/main/java/com/mycompany/app/App.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/mycompany/app/App.java b/src/main/java/com/mycompany/app/App.java index e4aed06..4f9e0f7 100644 --- a/src/main/java/com/mycompany/app/App.java +++ b/src/main/java/com/mycompany/app/App.java @@ -19,6 +19,7 @@ import java.lang.Math; import java.lang.Object; +import java.nio.channels.Selector; //import user-built specific class import com.mycompany.app.*; @@ -45,6 +46,7 @@ import com.mycompany.app.Animal.*; import com.mycompany.app.Sequence.SequenceA; +import com.mycompany.app.Sequence.Selector; import com.mycompany.app.Node.*; @@ -174,9 +176,13 @@ public static void main(String[] args) { for(int i=0; i<10; i++){ seq.add(Integer.toString(i)); } - System.out.println("sequence"+ seq); - + Selector sl = seq.getSelector(); + while (!sl.end()){ + + System.out.println("sequence"+ sl.current()); + sl.next(); + }