因為專業所以放心

          學習是沒有起點和終點的......

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            15 Posts :: 0 Stories :: 1 Comments :: 0 Trackbacks

          Map
          ------------------
          map iim = new map(types::integer, types::class);
          mapIterator it;
          // Add some elements into the list...
          iim.insert(1, new query());
          iim.insert(2, new query());
          iim.insert(4, new query());
          // Create a list iterator
          it = new mapIterator (iim);
          print it.definitionString(); // prints “[int -> class] iterator”
          print it.toString(); // prints “(begin)[(1 -> Query: query object 38824e0)]”
          // Go on for as long as elements are found in the set...
          while (it.more())
          {
          // fetch the next element
          print it.key(); // prints 4 2 1
          print it.value().toString(); // print something like Query object 3881270
          it.next();
          }
          print it.toString();??? // prints (end)
          pause;
          -----------------------------------
          Set
          ------------------
          set s1 = new set (types::integer);
          int theElement;
          setIterator it;
          // Add some elements...
          s1.add(3);
          s1.add(4);
          s1.add(13);
          s1.add(1);
          // Start a traversal of the elements in the set.
          it = new setIterator(s1);
          // The elements??? are fetched in the order: 1, 3, 4, 13
          print it.toString(); //??? prints “(begin)[1]”
          while (it.more())
          {
          //? Fetch the next element
          theElement = it.value();
          print theElement;
          it.next();
          }
          pause;
          -----------------------------------
          List
          ----------------------
          list il = new list(types::integer);
          listIterator it;
          // Add some elements into the list...
          il.addStart(1);
          il.addStart(2);
          il.addStart(4);

          // Create a list iterator
          it = new listIterator (il);
          ?? print it.definitionString(); // prints “int list iterator”
          ?? print it.toString(); // prints “(begin)[4]”
          // Go on for as long as elements are found in the list...
          while (it.more())
          ?? {
          // fetch the next element
          print it.value(); // prints 4 2 1
          it.next();
          ?? }
          print it.toString();??? // prints (end)
          pause;

          posted on 2006-08-12 11:21 舞熙 閱讀(284) 評論(0)  編輯  收藏 所屬分類: 程序設計語言
          主站蜘蛛池模板: 沙湾县| 阿拉尔市| 福清市| 奎屯市| 阿克苏市| 邮箱| 青神县| 潞西市| 崇信县| 聊城市| 宝丰县| 青海省| 平远县| 清苑县| 绵竹市| 黄平县| 蓬安县| 石首市| 永城市| 枣庄市| 阜阳市| 花莲县| 台东市| 泸溪县| 五大连池市| 抚顺县| 荃湾区| 云阳县| 科尔| 满洲里市| 平山县| 闽侯县| 黄冈市| 安新县| 阿城市| 亳州市| 饶平县| 华宁县| 石景山区| 昌黎县| 运城市|