home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jsamples.z / Sequences6.java < prev    next >
Encoding:
Java Source  |  1997-07-30  |  967 b   |  29 lines

  1. // Copyright(c) 1996,1997 ObjectSpace, Inc.
  2. import COM.objectspace.jgl.*;
  3.  
  4. public class Sequences6
  5.   {
  6.   public static void main( String[] args )
  7.     {
  8.     SList slist1 = new SList();
  9.     slist1.add( "D" );
  10.     slist1.add( "B" );
  11.     SList slist2 = new SList();
  12.     slist2.add( "E" );
  13.     slist2.add( "A" );
  14.     slist2.add( "C" );
  15.     System.out.println( "slist1 = " + slist1 + ", slist2 = " + slist2 );
  16.  
  17.     // Insert the whole of slist2 in front of the 1st element of slist1.
  18.     slist1.splice( 0, slist2 );
  19.     System.out.println( "slist1 = " + slist1 + ", slist2 = " + slist2 );
  20.  
  21.     // Move the 1st element to the end of the slist.
  22.     slist1.splice( 5, slist1, 0 );
  23.     System.out.println( "slist1 = " + slist1 + ", slist2 = " + slist2 );
  24.  
  25.     // Move the 2nd and 3rd elements to be in front of the last element.
  26.     slist1.splice( 4, slist1, 1, 2 );
  27.     System.out.println( "slist1 = " + slist1 + ", slist2 = " + slist2 );
  28.     }
  29.   }