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

  1. // Copyright(c) 1996,1997 ObjectSpace, Inc.
  2.  
  3. import COM.objectspace.jgl.*;
  4.  
  5. /**
  6.  * Splicing a piece of a SList into another.
  7.  *
  8.  * @see COM.objectspace.jgl.Vector
  9.  * @version 2.0.2
  10.  * @author ObjectSpace, Inc.
  11.  */
  12.  
  13. public class SList6
  14.   {
  15.   public static void main( String[] args )
  16.     {
  17.     SList list1 = new SList();
  18.     list1.add( "apple" );
  19.     list1.add( "banana" );
  20.     SList list2 = new SList();
  21.     list2.add( "lotus" );
  22.     list2.add( "ferrari" );
  23.     list2.add( "lamborghini" );
  24.     System.out.println( "before: list1 = " + list1 + ", list2 = " + list2 );
  25.  
  26.     SListIterator i = list1.begin();
  27.     i.advance();
  28.     SListIterator start = list2.begin();
  29.     SListIterator finish = list2.begin();
  30.     finish.advance( 2 );
  31.     list1.splice( i, list2, start, finish );
  32.     System.out.println( "after: list1 = " + list1 + ", list2 = " + list2 );
  33.     }
  34.   }
  35.