The code in the loadFile() method below seems to call for a LinkedList, but I'd rather
you guys not get too held that on that. JDiff.java is again just a quick&dirty program
written to test the library. I wouldn't devote too much time to it until someone finds
a place where it can be used.
Juanco
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of John McNally
> Sent: Wednesday, February 27, 2002 3:20 PM
> To: Turbine Developers List
> Subject: Re: cv
>
>
> Why not a LinkedList? I ask because James mentioned the use of
> ArrayList as a catchall collection as a petpeeve of his, when in many
> cases random access is not going to be used or it will be used rarely.
> I did not look to see whether that was the case here, just thought I'd
> take this opportunity to invite discussion on our general tendency to
> swap ArrayList for Vector, when another list type might be appropriate.
>
> john mcnally
>
> [EMAIL PROTECTED] wrote:
> >
> > dlr 02/02/27 10:16:54
> >
> > Modified: src/java/org/apache/maven/jrcs JDiff.java
> > Log:
> > Vector -> ArrayList
> >
> > Revision Changes Path
> > 1.2 +4 -3
> jakarta-turbine-maven/src/java/org/apache/maven/jrcs/JDiff.java
> >
> > Index: JDiff.java
> > ===================================================================
> > RCS file:
> /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/JDi
> ff.java,v
> > retrieving revision 1.1
> > retrieving revision 1.2
> > diff -u -u -r1.1 -r1.2
> > --- JDiff.java 27 Feb 2002 16:15:36 -0000 1.1
> > +++ JDiff.java 27 Feb 2002 18:16:54 -0000 1.2
> > @@ -58,8 +58,9 @@
> > import java.io.BufferedReader;
> > import java.io.FileReader;
> > import java.io.IOException;
> > +import java.util.ArrayList;
> > import java.util.Date;
> > -import java.util.Vector;
> > +import java.util.List;
> >
> > import org.apache.maven.jrcs.diff.Diff;
> > import org.apache.maven.jrcs.diff.Revision;
> > @@ -71,11 +72,11 @@
> > static final String[] loadFile(String name) throws IOException
> > {
> > BufferedReader data = new BufferedReader(new
> FileReader(name));
> > - Vector lines = new Vector();
> > + List lines = new ArrayList();
> > String s;
> >
> while ((s = data.readLine()) != null)
> > {
> > - lines.addElement(s);
> > + lines.add(s);
> > }
> > return (String[])lines.toArray(new String[lines.size()]);
> > }