Build your own linked list : LinkList Yours « Data Structure « VB.Net

VB.Net
1. 2D
2. Application
3. Class
4. Data Structure
5. Database ADO.net
6. Development
7. Event
8. File Directory
9. Generics
10. GUI
11. Language Basics
12. Network Remote
13. Thread
14. Windows System
15. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net Tutorial
VB.Net » Data Structure » LinkList YoursScreenshots 
Build your own linked list
Build your own linked list

Imports System
Imports System.Collections


Public Class MainClass

  Shared Sub Main()
    Dim fooaLinkedList As New LinkedList("A")
    Dim aLink As Link
    aLink = fooaLinkedList.MakeLink(fooaLinkedList.GetFirstLink, "B")
    aLink = fooaLinkedList.MakeLink(aLink, "C")
    Console.WriteLine(fooaLinkedList.GetFirstLink.MyData)
    aLink = fooaLinkedList.GetNextLink(fooaLinkedList.GetFirstLink)
    Console.WriteLine(aLink.MyData)
    Console.WriteLine(aLink.NextLink.MyData)
  End Sub
End Class

  Public Class LinkedList
    Private m_CurrentLink As Link
    Private m_FirstLink As Link
    Sub New(ByVal theData As String)
      m_CurrentLink = New Link(theData)
      m_FirstLink = m_CurrentLink
    End Sub
    
    Public Function MakeLink(ByVal currentLink As Link, ByVal theData As StringAs Link
      m_CurrentLink = New Link(currentLink, theData)
      Return m_CurrentLink
    End Function
    Public ReadOnly Property GetNextLink(ByVal aLink As LinkAs Link
      Get
        Return aLink.NextLink()
      End Get
    End Property
    Public ReadOnly Property GetCurrentLink() As Link
      Get
        Return m_CurrentLink
      End Get
    End Property
    Public ReadOnly Property GetFirstLink() As Link
      Get
        Return m_FirstLink
      End Get
    End Property



  End Class

  Public Class Link
      Private m_MyData As String
      Private m_NextLink As Link
      Friend Sub New(ByVal myParent As Link, ByVal theData As String)
        m_MyData = theData
        myParent.m_NextLink = Me
      End Sub
      Friend Sub New(ByVal theData As String)
        m_MyData = theData
      End Sub
      Friend ReadOnly Property MyData() As String
        Get
          Return m_MyData
        End Get
      End Property
      Friend ReadOnly Property NextLink() As Link
        Get
          Return m_NextLink
        End Get
      End Property
  End Class
           
       
Related examples in the same category
w__w_w_._j__a__v___a___2__s.__c_o__m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.