Hi people,

This is my first post here. It really is a nice community, especially for people who are not "qualified" programmers with the "attitude". I am a programmer by hobby and did not like being in any community previously. There are some really nasty folk.
Great job guys! This place feels like home :)

Anyway, getting to the point,

I have two ArrayLists of Point objects (sorted by x) ... of the form
[{x,y}, {x,y}, {x,y}, ...]

1. How can i merge them both and also keep the sort (or 2 diff steps) the fastest
2. How can i export this array list as a string of coordinates or csv or any other format that i can mess around with in notepad or something.

The Debug.print is not working... so i gotta try something else.

Thanks in advance!

hello and welcome !
you can merge this way

'add each point in A2 to A1
        For Each pt In ArList2

then re-sort all in A1

Dim cmp As New PointsComparer

you will need this class

Public Class PointsComparer
    Implements IComparer

    Public Function Compare(ByVal p1 As Object, ByVal p2 As Object) As Integer _
     Implements System.Collections.IComparer.Compare
        Return p1.X.CompareTo(p2.X)
    End Function
End Class

for the csv, i suggest this :
but some regions use the "," as the decimal delimiter so maybe changing to another delimiter is better.
so you may write:

Dim StrBuilder As New System.Text.StringBuilder
        For Each pt As Point In ArList1
            StrBuilder.Append(pt.X.ToString & "," & pt.Y.ToString & vbCrLf)
This question has already been answered. Start a new discussion instead.