Java collections in D

BLS nanali at wanadoo.fr
Wed Oct 11 09:01:04 PDT 2006


Hi,
I like to translate the following Java code into D. (reason follows)

**
  * Collection interface; the root of all Java 1.5 collections.
  */
public interface Collection<AnyType> extends Iterable<AnyType>, 
java.io.Serializable
{
     int size( );

     boolean isEmpty( );

     // and so on ..............
     /**
      * Obtains an Iterator object used to traverse the collection.
      * @return an iterator positioned prior to the first element.
      */
     Iterator<AnyType> iterator( );

     /**
      * Obtains a primitive array view of the collection.
      * @return the primitive array view.
      */
     Object [ ] toArray( );
	
     /**
      * Obtains a primitive array view of the collection.
      * @return the primitive array view.
      */
     <OtherType> OtherType [ ] toArray( OtherType [ ] arr );
}

Reason :
Converting (a lot of ) Java code into D requires java collections in D. 
(also automatic Java2D translation will benefit)

Questions :
1) exists allready something simular to ITERABLE, SERIALIZABLE (have not 
seen the interf. yet)

2) <OtherType> OtherType [ ] toArray( OtherType [ ] arr );
Simply ??????.

Many thanks in advance! ,
Björn









More information about the Digitalmars-d-learn mailing list